Advertisement
DraKiNs

[COD] httpRequest

Jul 10th, 2011
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function httpGetRequest(url)
  2. {
  3.  
  4.     var ipsRtr = "";
  5.     var ipsReq = new XMLHttpRequest();
  6.     var e = 0;
  7.  
  8.     try
  9.     {
  10.         var ipsReq = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
  11.  
  12.     }
  13.  
  14.     catch (e)
  15.     {}
  16.     ipsReq.onreadystatechange = function ()
  17.     {
  18.         alert(ipsReq.status);
  19.         if ((ipsReq.readyState == 4) && (ipsReq.status == 200))
  20.         {
  21.             ipsRtr = ipsReq.responseText;
  22.  
  23.         }
  24.     }
  25.     ipsReq.open("GET", url, false);
  26.     ipsReq.send(null);
  27.  
  28.  
  29.  
  30.     if (ipsRtr == "")
  31.     {
  32.         $.get(
  33.         url, function (data)
  34.         {
  35.             ipsRtr = data;
  36.         });
  37.     }
  38.     if (ipsRtr == "")
  39.     {
  40.         return alert("[ERRO] Desconhecido");
  41.     }
  42.     return ipsRtr;
  43. }
  44.  
  45. // Por Bruno da Silva
  46. // Nota: Precisa a biblioteca jQuery
  47. // www.ips-team.blogspot.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement