Tags: request

Sort by: Date / Title /

  1. 1 month ago by nox.freak
    This will get the last entry into a database where COL is equal to something.
    1. SELECT * FROM TABLE WHERE COL=something ORDER BY id DESC LIMIT 0,1
  2. 1 month ago by nox.freak
    Handles response from an ajax request.
    1. function ajaxRequest()
    2. {
    3.         var opt = 's=whatever you want to pass';
    4.         var page = 'ajax_page.php';
    5.  
    6.         var http = createRequestObject();
    7.         http.onreadystatechange = function()
    8.         {
    9.                 if((http.readyState == 4) && (http.status == 200))
    10.                 {
    11.                         var text = http.responseText;
    12.                 }
    13.         }
    14.         http.open('POST', page, true);
    15.         http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    16.         http.setRequestHeader("Content-length", opt.length);
    17.         http.setRequestHeader("Connection", "close");
    18.         http.send(opt);
    19. }
  3. 1 month ago by nox.freak
    Checks to see if browser is IE based or other.
    1. function createRequestObject(handler)
    2. {
    3.         var xmlHttp;
    4.         try
    5.         {
    6.                 // Firefox, Opera 8.0+, Safari
    7.                 var xmlHttp = new XMLHttpRequest();
    8.                 xmlHttp.onload=handler;
    9.                 xmlHttp.onerror=handler;
    10.                 return xmlHttp;
    11.         }
    12.         catch (e)
    13.         {
    14.                 // Internet Explorer
    15.                 try
    16.                 {
    17.                         xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    18.                         return xmlHttp;
    19.                 }
    20.                 catch (e)
    21.                 {
    22.                         try
    23.                         {
    24.                                 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    25.                                 return xmlHttp;
    26.                         }
    27.                         catch (e)
    28.                         {
    29.                                 alert("Your browser does not support AJAX!");
    30.                                 return false;
    31.                         }
    32.                 }
    33.         }
    34. }
  4. sponsorised links

First / Previous / Next / Last / Page 1 of 1 (3 posteets)