Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Ajax loading image

  • 23-07-2009 09:52PM
    #1
    Registered Users, Registered Users 2 Posts: 387 ✭✭


    I want to display a loading .gif image while I'm waiting for an ajax request to complete. Here's my code for sending the ajax request -
    $.get('server.php', { 'name' : 'john' }, 
             function(data){
               $('#results').html(data);
      });
    

    What do I need to add to display a loading image?


Comments

  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    I want to display a loading .gif image while I'm waiting for an ajax request to complete. Here's my code for sending the ajax request -
    $.get('server.php', { 'name' : 'john' }, 
             function(data){
               $('#results').html(data);
      });
    

    What do I need to add to display a loading image?
    $("#divContainingImage").show();
    $.get('server.php', { 'name' : 'john' }, 
             function(data){
               $('#results').html(data);
               $("#divContainingImage").hide();
      });
    


  • Registered Users, Registered Users 2 Posts: 387 ✭✭gimme5minutes


    cheers mate, works like a charm!


Advertisement