Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default How do I query a database using AJAX.

    A perfect example would be Simons "Find a Habbo" function in invent.no-ip.org/hl2/ thanks..
    How could this hapen to meeeeeeeeeeeeeee?lol.

  2. #2
    Join Date
    Feb 2008
    Location
    North Carolina, USA.
    Posts
    172
    Tokens
    0

    Default

    Easy way: Scriptaculous.

    Code:
    var handlerFunc = function(t) {
        alert(t.responseText);
    }
    
    var errFunc = function(t) {
        alert('Error ' + t.status + ' -- ' + t.statusText);
    }
    
    //For an XML response:
    var handlerFunc = function(t) {
        var xmlDoc = t.responseXML.documentElement;
        //Handle data.
    }
    
    new Ajax.Request('bla.php', {parameters:'thisvar=true&thatvar=Howdy', onSuccess:handlerFunc, onFailure:errFunc});
    bla.php just echos out what you want..

    You could also change the handlerFunc to

    Code:
    document.getElementById('mydiv').innerHTML = t.responseText;
    Last edited by Zedtu; 16-02-2008 at 12:27 AM.

  3. #3
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    So that would work out as querying it without changing the page as bla.php?q=login&x=anotherparam

    ?? but I could use like a loading image eg windows live mails
    How could this hapen to meeeeeeeeeeeeeee?lol.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •