Guest User

Untitled

a guest
Jun 9th, 2012
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. debugging chrome extension
  2. ...
  3.  
  4. function init() {
  5. getdata();
  6. }
  7.  
  8. var txt;
  9. function getdata() {
  10. var xhr = new XMLHttpRequest();
  11. xhr.open('GET',myurl, true);
  12. xhr.setRequestHeader('Cache-Control', 'no-cache');
  13. xhr.setRequestHeader('Pragma', 'no-cache');
  14. xhr.onreadystatechange = function() {
  15. if (xhr.readyState == 4) if (xhr.responseText) {
  16. txt = xhr.responseText;
  17. }
  18. }
  19.  
  20. xhr.send();
  21. console.log(txt);
  22. }
  23.  
  24. ...
  25.  
  26. <body onload="init();">
  27.  
  28. ...
Advertisement
Add Comment
Please, Sign In to add comment