Guest User

How would I use jQuery to grab the contents of a page and render it within a div

a guest
Feb 11th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. function render_message(id)
  2. {
  3. var xmlHttp;
  4. xmlHttp=new XMLHttpRequest();
  5. xmlHttp.onreadystatechange=function()
  6. {
  7. if(xmlHttp.readyState==4)
  8. {
  9. document.getElementById('message').innerHTML=xmlHttp.responseText;
  10. document.getElementById('message').style.display='';
  11. }
  12. }
  13. var url="include/javascript/message.php";
  14. url=url+"?q="+id;
  15. xmlHttp.open("GET",url,true);
  16. xmlHttp.send(null);
  17. }
  18.  
  19. $('#message').load("include/javascript/message.php", {q: id}, function() {
  20. $(this).show();
  21. });
  22.  
  23. $("#mydiv").load("a/url/here.html");
Advertisement
Add Comment
Please, Sign In to add comment