I need urgent help, please please please

Discussion in 'JavaScript' started by deriklogov, Apr 30, 2010.

  1. #1
    I have to run php script from java script (html)

    I am doing it like :

    <HTML>
    <BODY>
    <script src="http://testsite.com/countimpr.php" type="text/javascript"></script>
    </BODY>

    and its working fine, but I need to send to php full url of the current page, because php script can not get this information due to running from java,
    what is the best way to do that ?
    Like I was thinking to send it wirh variable like
    countimpr.php?url=
    but I dont know how to set java variable in this case
     
    deriklogov, Apr 30, 2010 IP
  2. skier88

    skier88 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you could try something like this:

    
    <html>
    <body>
    <script type='text/javascript'>
    document.write("<script src='http://testsite.com/countimpr.php?url="+document.location+"' type='text/javascript'></script>");
    </script>
    </body>
    </html>
    
    Code (markup):
     
    skier88, May 9, 2010 IP
  3. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #3
    escape it lol.
    escape(document.location)
     
    gapz101, May 12, 2010 IP