Jump to content

how to get info to a javascript function from php?


ballhogjoni

Recommended Posts

I want to have my users embed this script: <script type="text/javascript">submit_url = "WEBSITE_URL";</script><script type="text/javascript" src="http://xxxxxxxxx/templates/wistie/js/submit.js"></script>

 

into their sites. when they do it runs the function below:

 

function aggreeWithIt() {
var check = window.parent.submit_url;
if(!check) {
	var url1 = document.URL;
} else {
	var url1 = window.parent.submit_url;
}
	var url2 = 'http://xxxxxxxxxx/submit.php?url=' + url1;
document.write('<a style="font-size:10px;text-align:center;" href="' + url2 + '">'
                    + '<img src="" border="" width="32" height="32" /><br/>Aggree w/ It</a>');
}
aggreeWithIt();

 

Now with in that function I need to get some information from my database via php, to display in the document.write() string above.

 

I was thinking of creating a php script that would be called first and get the data then display it in the js function, but I would like to just do it within the js script I have written.

 

Any ideas? Hope that made sense.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.