Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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