Jump to content

How do I execute a PHP page from HTML using javascript?


megetron

Recommended Posts

Hello all,

 

I am trying to create a link tracker.

 

I created a javascript file : trackincode.php?lid=1 and in it this line:

Response.Write("document.write(\"Hello World\");");

Now, I want to call this file from an HTML file, so I copy/paste this HTML:

<script language='javascript'  type='text/javascript'>

var r=document.referrer;

var counter = new Object();

counter.src = 'http://domain.com/trackingcode.php?lid=7&r='+r;

</script><script src=http://domain.com/trackingcode.php?lid=7>

</script>

 

unfortunattly the code does not display the text "Helloo World" and the file is not executed... Any suggestions?

 

NOTE: I know this code works on another servers...

 

Link to comment
Share on other sites

Response.write() - is this wrapped in ASP or something?

please ignore "Response.Write"...my mistake.

the full code is this:

<?echo "document.write(\"Hello World\");";?>

Here you have a link to the file (I rename the file to "get_trackingcode1.php")

http://affilinn.co.il/get_trackingcode1.php?aid=1&linkid=N1

 

I expect to see "Hello World" text when calling the page using javascript.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.