I have an HTML page with a typical structure:
<html> <head> <script src="..." ></script> <style>...</style> </head> <body> content </body> <script> var success_callback = function(data) { // REPLACE PAGE CONTENT & STRUCTURE WITH "data" } ajax(url, params, success_callback); </script> </html>
Do you think it is possible ? I've already tried to give the html tag an id and doing $(id).replace(data);
with no success.
Don't ask me why, but that is what I need (I'm working with a special "mashup builder" site... it is a long story).
EDIT : I forgot to say that scripts in the received content have to be executed, even external scripts included using <script src="...">
.
The simplest way is to set the new HTML content using:
document.open(); document.write(newContent); document.close();
try this with jQuery:
$('body').load( url,[data],[callback] );
Read more at docs.jquery.com / Ajax / load
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With