PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
could potentially use XMLHTTP objects to request the remote code via the browser for execution through eval()
Place the <script> tag where it can be overwritten after a specific in-page timeout is reached.. you should be able to check to see if something it defines exists at intervals to determine if the data is loading..
could use a local php script that makes a periodic request for the page on behalf of your server, storing the results in a database or local file. Thus allowing you to pass to your users a cached version of their last response.
anjanesh
Tell me more... Makes since, but I think were missing something.... I would expect that showHeadLines() needs to be positioned down in the body where it needs to display the headline...
feyd
could use a local php script that makes a periodic request for the page on behalf of your server, storing the results in a database or local file. Thus allowing you to pass to your users a cached version of their last response.
This is what I was thinking.
Is there a 'canned' solution to this? Tell me more.
Try keeping <script></script> within <head></head> tags - esp when there are functions. It wont make a difference if the showHeadLines() is at the bottom of body. It'll be executed only when the entire body (page) is loaded.
And your JS line <script src="http://headlines.site.org/headlines/feed.js"></script> will written by Javascript when you call it any time <script type="text/javascript">showHeadLines()</script>
I need the headline displayed on Line 19.
I understand how we're loading the js code after the page load... But I don't see how we actually display the headline (in the table).
I guess you're not able to get it to work.
Changing the value of innerHTML to <script></script> is not getting the script to load. Dont know why. I thought it would. But document.write() will do the job though.
Changing the value of innerHTML to <script></script> is not getting the script to load. Dont know why. I thought it would. But document.write() will do the job though.
So, I should replace innerHTML with document.write() ?
you must if you want Javascript to write javascript, otherwise the handler will read your text as Javascript itself, not a string you want to write.
The onload function will perform when the page has finished loading.
A document.write() will write (append to html code) at last.
But you wanted it in between <td></td> somewhere in the middle. For that I thought changing innerHTML to <script></script> will work but its not. The innerHTML is defintely changed - try changing the value of innerHTML to <b>hello</b> and it'll show hello in bold. But scripts dont seem to be running.