Build an AJAX search bar

You may also like...

30 responses to “Build an AJAX search bar”

  1. Batfan says:

    Very nice tut. Would prefer something more simple though (ie. storing the search terms in an XML file). Their just search terms so, I’m not sure they need the security or hassle of setting up a MySQL db.

  2. Scott Madden says:

    Thanks for the wonderful article I have added a link to it in the Tutorials section on the sidebar of our site.

  3. Andy Leon says:

    Hi all,

    It’s worth noting that this was part of a series and in an earlier part we had set up the Web server and PHP configuration. Back then, PHP had “magic_quotes_gpc” switched on by default. This escapes all incoming GET and POST variables to make them safe for database queries. This is no longer the case, so if your PHP config is not set up like this, you should use the mysql_real_escape_string() as part of Step 12.

    $Cities = mysql_query(‘select * from City where Name like “%’.mysql_real_escape_string($SearchInput).’%” order by Population desc limit 10’);


  4. Kate says:

    Thanks, I will be adding this to my favorites.

    Atlanta Web Design

  5. ling says:

    Where do you add the list of cities in the PHP file?

  6. Nice tut, cheers I may use that in a up coming project

  7. […] Designer magazine have put one of the articles I wrote for them on Building an Ajax Search Bar up on their site. Originally published in Issue 159 of the magazine, this was part of a series […]

  8. Hi, do you have any link or something similar but for ASP.NET? Ty for a nice article but if it were in it would be superb ;)

  9. Thanks it’s great.i will use this script on my site.

  10. IBU says:

    In the beginning of this tutorial it says “we’re going to be using the MySQL World Database, a sample database provided by MySQL that contains information on cities and countries”. I don’t see none of these files in your tutorials or the maybe clarification that we need to create these file by ourselves.

  11. Great tutorial! I will use it in one of my future projects.

  12. ash says:

    in this how should i include ajax (the page should not refresh and the data should come directly when we enter)

    help textbox

    //Make a MYSQL connection
    mysql_connect("localhost", "root", "") or die(mysql_error());
    mysql_select_db("Help") or die(mysql_error());
    //get all the data from unleashpm_overview table
    $name = $_POST['name'];
    $result = mysql_query("SELECT * FROM ajax_unleashpm_overview WHERE Question LIKE '%$name%'");
    //keeps getting the next row until there are no more to get
    while($row = mysql_fetch_array( $result )) {
    // Print out the contents of each row
    echo $row['Question'];
    echo '’;
    echo $row[‘answer’];
    echo ”;

  13. […] Build an AJAX search bar | Web Designer – Defining the internet through beautiful design […]

  14. Peter says:

    Great Tutorial!
    I would like to use some of this code on my page. When I type in the search box, the results are shown, and when I click on a result, the page refreshes and the search box has the default text.

    I want to be able to select one result and have it displayed in the search box. How do I do that? And without the page refreshing.

  15. Hello mates, fastidious paragraph and nice arguments commented at this place, I
    am actually enjoying by these.

  16. Great article! We will be linking to this great article on our site.

    Keep up the good writing.

  17. Hi there friends, how is everything, and what you desire to say about this paragraph, in my view its
    actually remarkable in favor of me.

  18. I have read so many articles or reviews on the topic of the blogger lovers but
    this piece of writing is in fact a pleasant paragraph, keep it up.

  19. with brand new releases! Wow! Sound Terrific!Step 1 — Find a person’s Indiana Jones as well as Kingdom of your Crystal Mind Movie first you’ll be able to
    Search quite a few titles since you want, there tend to be no restricts.
    Browse many files in your favorite movie channels,
    television exhibits, sporting events plus more. Once
    you decide on what you are looking proceed to another location
    step.Step only two – Save Indiana Jones
    plus the Kingdom of this Crystal Cranium Movie, next Click on the file you only found to start your acquire.
    You will download Indy Jones and also the Kingdom in the Crystal Mind Movie
    and many other poker guides immediately. Your once membership fee will provide you
    with FREE DIGITAL VIDEO DISC Copy Computer software, Movie Competitors, CD Using up Software, VIP
    tech support team and further!Step 3 : Burn Indianapolis
    Jones and also the Kingdom of this Crystal Cranium Movie that will DVD.
    Play a newly saved movie using your pc, Home Live theatre, or Hdtv.
    The services provide you with the software necessary to easily shed your DISC Videos
    to help CD or perhaps DVD. Build the DVD motion picture collection.
    Join now and discover all you need to give to millions for user around the globe!
    Wow, isnt wonderful which you can watch it all the time, Yes!

    So will not wait now and find Ready to watch out and In Jones and also Kingdom in the Crystal Brain Movie Nowadays!

    Indispensable Lcd television AccessoriesLuce mannequin TV pores and skin look stand
    solely model and keep in various areas of a family
    home, plane as well as yacht. It can be an ultra small television with high quality
    PC. This standalone TV isn’t going to require another components. The a few parallel watching sources that Luce style offers usually are HDTV keep an eye on and hd monitor. The extensive aspect monitor format utilized for the product is highly worthy of DTV, DVD in addition to HDTV resource material.You will be able to view this kind of model inside bright light along with in almost any angle with the comfort of one’s room.

    This is realistic a result of wide experiencing angle
    and also high lumination level enjoyed by your monitor.
    The living quarters of your abode or office is usually augmented and living area can end up increased using
    the fence mounts. Wall supports of plasma tv set of LCD video are suitable with the aim.
    The benefits of using these units are a good number of.

    The unit will be wall attached with the various models of walls
    car without any flat solar panel. Gold plated attaches are utilized specially to
    get superior alert. 99. 95 p’cent oxygen absolutely free copper is required in the gps watch. The 1 metre greyish scat incorporated while in the unit provides you with affordable.Wall brackets are you can buy to meet on all sorts of wall space. They may carry some weight with 30 kgs. LCD home appliances are televisions, at days are given the small-scale tilt mount that is suitable intended for flat section televisions. The compact tilt offered on the market usually satisfies thirteen within . to twenty-four inch telly displays. Projector wall mounts too tend to be obtainable in the LCD home appliances are televisions.Mounts can be acquired for tv mount, wall support, screen support, desk position and threshold mount. Real hardwood veneer through safety goblet shelves tend to be attractive and provide a sensible look. Besides providing ample increasing space moreover it acts because storage designed for DVD’s,
    controllers along with other accessories with regard to gaming.
    They possess soft finishing doors. Enough fresh air is provided to make sure efficient
    operating from the device. Cable administration
    provided in your unit helps prevent clutter and keep your wires planned.
    The system features a good performance thanks to high top quality
    leads utilized for it. You will get high superior cables designed for speakers.
    It will let you enjoy a complete potential belonging to the device such as best
    smart quality not to mention vision. Decorative cable-trunking features are specially provided to cover speaker connections.
    A disguise of covered aluminium has the display cleaner.

    The clearer removes acne bacteria. However, it just isn’t advised to work with it upon flat screens because the alcohol together with sponge could harm the actual screen. The brand new innovation from the technology can be LC TV FOR PC phone, which are made for business individuals.They consist of two fast access to the internet, 2 SIM charge cards, touch computer screen, two video cameras, sliding display, micro SD position, memory minute card, GPRS, GSM, FAX, many wide variety of computer secrets, blue the teeth, television recorder, Email, television routine, movie participant and a variety of others.In house Antenna- Assistive Touch For Auto Tv AntennaI am certain that your hunt for indoor antenna has reach an end when you read this information. Yes, gone are days gone by when we must search forever for {backyard|interior|inside|indoors

  20. ilex says:

    Tips on how to Select Ideal Projector

  21. casinoeuro says:

    Have more From home Media With your Great Electronic devices!

  22. Every weekend i used to visit this web site, because i want enjoyment,
    for the reason that this this site conations really nice funny stuff too.

    Visit my wesbite at liposuction dominican republic

  23. XRumerTest says:

    Hello. And Bye.

  24. Napoleon says:

    Fantastic goods from you, man. I have understand your stuff previous to and you’re just extremely magnificent. I really like what you have acquired here, certainly like what you are saying and the way in which you say it. You make it entertaining and you still care for to keep it wise. I cant wait to read far more from you. This is actually a terrific site.

  25. Foster says:

    Hello would you mind stating which blog platform you’re working with? I’m looking to start my own blog soon but I’m having a tough time making a decision to go with WordPress.

  26. you’re really a good webmaster. The site loading speed is amazing. It seems that you are doing any unique trick. In addition, The contents are masterpiece. you have done a magnificent job on this topic!

  27. Attractive element of content. I simply stumbled upon your blog and in accession capital to say that I acquire actually loved account your weblog posts. Anyway I’ll be subscribing for your feeds or even I achievement you get admission to constantly quickly.

  28. Emmitt says:

    wonderful issues altogether, you simply gained a logo new reader. What would you suggest about your put up that you made some days in the past? Any positive?

  29. Inocencia says:

    Do you have a spam issue on this website; I also am a blogger, and I was wanting to know your situation; we have developed some nice procedures and we are looking to swap techniques with other folks, why not shoot me an email if interested.

Leave a Reply

Your email address will not be published. Required fields are marked *