Posted By

KernelPanic on 07/17/08


Tagged

ajax textmate XMLHttpRequestObject


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

SpinZ
cjwilburn
wirenaught


Create XMLHttpRequest


 / Published in: JavaScript
 

  1. function createXMLHttpRequestObject() {
  2. var resObject = null;
  3.  
  4. try {
  5. resObject = new ActiveXObject("Mircosoft.XMLHTTP");
  6. window.console.log("Microsoft.XMLHTTP");
  7. }
  8.  
  9. catch (error) {
  10. try {
  11. resObject = new ActiveXObject("MSXML2.XMLHTTP")
  12. window.console.log("MSXML2.XMLHTTP");
  13. }
  14. catch(error) {
  15. try {
  16. resObject = new XMLHttpRequest();
  17. window.console.log("XMLHttpRequest");
  18. }
  19. catch (error) {
  20. alert("XMLHttpRequest-Objekt konnte nicht erzeugt werden.");
  21. }
  22. }
  23. }
  24.  
  25. return resObject;
  26. }

Report this snippet  

You need to login to post a comment.