empty search results boxes appear with hour glass and populate with query results few seconds later

Discussion in 'PHP' started by pmf123, Jul 29, 2014.

  1. #1
    ok so im working on a site where there are 5 or more results boxes on a page for search results (not web searches, searches of each of my databases) and i want the boxes to appear instantly with an hour glass or spinning wheel in each until each of the results are populated.

    Is this done using iframes or something similar?

    An example of what I am trying to do would be to search 4 separate databases for a persons name and put the results in each of the four results boxes... the page appears instantly when a search is started, and the hour glass appears in each box while the query is happening
     
    pmf123, Jul 29, 2014 IP
  2. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #2
    ThePHPMaster, Jul 29, 2014 IP
  3. pmf123

    pmf123 Notable Member

    Messages:
    1,449
    Likes Received:
    81
    Best Answers:
    0
    Trophy Points:
    215
    #3
    can you use ajax in php? if not, is there an alternate?
     
    pmf123, Jul 30, 2014 IP
  4. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #4
    ThePHPMaster, Jul 30, 2014 IP
  5. pmf123

    pmf123 Notable Member

    Messages:
    1,449
    Likes Received:
    81
    Best Answers:
    0
    Trophy Points:
    215
    #5
    I found this example incase anyone else is wondering...

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/">
    <html xmlns="http://www.w3.org/1999/xhtml/">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Demo</title>
    <script type="text/javascript" src="/assets/script/jquery-1.4.2.min.js"></script>
    </head>

    <body>
    <script type="text/javascript">
    $(function() {
    $.ajax({
    type: "GET",
    url: "queryScript.php",
    success: function(resp) {
    $("#results").html(resp);
    }
    });
    });
    </script>
    <div id="results"><img src="/assets/images/icons/loading.gif" width="16" height="16" alt="Loading..." /></div>
    </body>
    </html>
     
    pmf123, Jul 31, 2014 IP
  6. pmf123

    pmf123 Notable Member

    Messages:
    1,449
    Likes Received:
    81
    Best Answers:
    0
    Trophy Points:
    215
    #6
    Got it working with a little tweak here and there... you can see my effort @ www.OldPhoneBook.com
     
    pmf123, Aug 11, 2014 IP
  7. chrisnagios

    chrisnagios Member

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #7
    thats a useful site, congrats!

    and with so good domain in .com,
    it wouldnt be hard to make it have good results..
     
    chrisnagios, Aug 11, 2014 IP
    pmf123 likes this.