Jump to content

XmlHttpRequest doesn't parse Javascript


ofs

Recommended Posts

My situation is that I have, for example, "page.php", which contains some external javascripts being called with the <script> tag. However, when I use XmlHttpRequest in, for example, "index.php" to get the result of "page.php", these external javascripts don't seem to be parsed at all. Even if I put the <script> tags in "index.php", it doesn't work. Any ideas of how to get around this?

Link to comment
https://forums.phpfreaks.com/topic/113526-xmlhttprequest-doesnt-parse-javascript/
Share on other sites

If I am understanding you correctly you are wanting to make a javascript call to a page which has JavaScript in it. I guess there are two possibilities on how you want that code run.

 

1) Have the code run in the external page to modify the results before being returned to the calling page. This makes little sense to me since you could do everything within the server-side code. Besides it won't work as the page is never actually loaded into the browser - and it is the browser that runs JavaScript.

 

2) You want to return some JavaScript tot he calling page to be used in that page. This is possible, but without more information on how you are implementing it I can't suggest much of a solution. There's alwasy the eval() function, but that's always a poor choice in my opinion.

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.