kbeat
kbeat

Reputation: 149

php: Get page contents with AJAX loaded

the page that i want to get from my php-script contains ajax. So when i do something like: file_get_contents($url);

i receive just the contents with javascript.

is it possible to get the page with all ajax executed?

Upvotes: 0

Views: 387

Answers (1)

Francis Lewis
Francis Lewis

Reputation: 8990

To run javascript contents from javascript coming in through AJAX, you would have to run eval on the script, but you better make absolutely sure the javascript isn't "user-input", otherwise using that, you could have some serious security issues on your hands.

It's also not good practice to use eval - better to load a js file when you pull the contents through AJAX and have your AJAX success activate a function in the js file.

Upvotes: 2

Related Questions