JS "JAH" Script by Kevin Marks


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function jah(url,target) {
  2. // native XMLHttpRequest object
  3. document.getElementById(target).innerHTML = ' ';
  4. if (window.XMLHttpRequest) {
  5. req = new XMLHttpRequest();
  6. req.onreadystatechange = function() {jahDone(target);};
  7. req.open("GET", url, true);
  8. req.send(null);
  9. // IE/Windows ActiveX version
  10. } else if (window.ActiveXObject) {
  11. req = new ActiveXObject("Microsoft.XMLHTTP");
  12. if (req) {
  13. req.onreadystatechange = function() {jahDone(target);};
  14. req.open("GET", url, true);
  15. req.send();
  16. }
  17. }
  18. }
  19.  
  20. function jahDone(target) {
  21. // only if req is "loaded"
  22. if (req.readyState == 4) {
  23. // only if "OK"
  24. if (req.status == 200) {
  25. results = req.responseText;
  26. document.getElementById(target).innerHTML = results;
  27. } else {
  28. document.getElementById(target).innerHTML="Whoops! n" +
  29. req.statusText;
  30. }
  31. }
  32. }
  33.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.