ballhogjoni Posted February 22, 2009 Share Posted February 22, 2009 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. Link to comment https://forums.phpfreaks.com/topic/146327-how-to-get-info-to-a-javascript-function-from-php/ Share on other sites More sharing options...
Q695 Posted February 22, 2009 Share Posted February 22, 2009 you could do it through a database field storage, which I personally would do if each client can put their own data on the page. Link to comment https://forums.phpfreaks.com/topic/146327-how-to-get-info-to-a-javascript-function-from-php/#findComment-768331 Share on other sites More sharing options...
Mchl Posted February 22, 2009 Share Posted February 22, 2009 You would use AJAX for that. Link to comment https://forums.phpfreaks.com/topic/146327-how-to-get-info-to-a-javascript-function-from-php/#findComment-768434 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.