ofs Posted July 7, 2008 Share Posted July 7, 2008 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? Quote Link to comment Share on other sites More sharing options...
ofs Posted July 8, 2008 Author Share Posted July 8, 2008 I may not have been clear enough. The problem seems to be that since XmlHttpRequest just gets the result of a file and posts it, no more parsing can be done. Is there a way to parse the javascript after the result of the file has been retrieved? Quote Link to comment Share on other sites More sharing options...
ofs Posted July 9, 2008 Author Share Posted July 9, 2008 Any ideas, guys? Quote Link to comment Share on other sites More sharing options...
ofs Posted July 9, 2008 Author Share Posted July 9, 2008 I've done more testing, and found that if a page being called with XmlHttpRequest has any javascript in it at all, the javascript on that page doesn't work. Is there a way to get it to work? Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 9, 2008 Share Posted July 9, 2008 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.