Live Search with Ajax

Posted by: Admin  :  Category: Mysql

Linux Cpanel shared hosting: 600 GB disk space, 6 TB bandwidth, free domain, unlimited databases and ftp accounts, web hosting cheap and pro at Hostony

Linux Cpanel shared hosting: 600 GB disk space, 6 TB bandwidth, free domain, unlimited databases and ftp accounts, web hosting cheap and pro at Hostony

Live search a mysql database with Mysql, php, jquery, ajax, javascript, html. Sound complicated? Its not. All you have to do is create a keyup listener on a text box and just make sql calls using ajax to grab the data.

Linux Cpanel shared hosting: 600 GB disk space, 6 TB bandwidth, free domain, unlimited databases and ftp accounts, web hosting cheap and pro at Hostony

22 Responses to “Live Search with Ajax”

  1. JohnTemoty Says:

    Thank you man… This is the tutorial i’ve been´╗┐ looking for.

  2. MrSbg91 Says:

    thanks man…
    ­čÖé

    keep on providing useful´╗┐ tuts..

  3. hacipikacu Says:

    Thanks a´╗┐ lot

  4. rammsftw Says:

    Thank you
    ´╗┐

  5. yakayaba Says:

    it’s working perfectly, but you need to add { after function(data) which´╗┐ is not visible on the screen. anyway gr8 tutorial optikalefxx

  6. nelsongg347 Says:

    Thank works fine. Now´╗┐ my question is how can I make appear or disappear the list, for instance I want the list to appear only when i type something in the textbox. I tried: creating an element div in javascript and setting its id attribute to the name of the div where the list is showed, if the value of the input box is other than empty string but nothing happend. Could anyone help me please?

  7. ivette0072 Says:

    …found the error now and it works fine. I´╗┐ had a syntax mistake in the php file. $POST instead of $_POST.

  8. ivette0072 Says:

    everything from my database was echoed when i type a character´╗┐ in textbox? i can’t figure it out. Anny suggestions? Great video´╗┐ BTW. Thanks a lot for that.

  9. optikalefxx Says:

    it does´╗┐ work, seen in the video. Your welcome to send me what you have and I can help.

  10. SuperRorylewis Says:

    it doesnt work i havent got code wrong either´╗┐

  11. Gomidas95 Says:

    sir I use jquery I´╗┐ did a live search but if I write letters very fast it says “Checking connection” and after that it includes ajax loading pape How can I fix it ???

  12. russellsolid Says:

    yh…. but im no good with´╗┐ JS lol hvnt learned it :p

  13. optikalefxx Says:

    you could also detect it in´╗┐ JS and not send to php, then just clear the div

  14. russellsolid Says:

    to show No results when text box is empty´╗┐ instead of all results simply
    surround you PHP file code with
    if($_POST[‘partialState’]){
    //all php code here
    }

  15. optikalefxx Says:

    so on keyup detect when the value is equal to´╗┐ blank. If it is, then delete the contents of your results box. If its not blank, then fill with results.

  16. MrCotcac Says:

    @optikalefxx how to remove the results when the textbox´╗┐ has no laters?

  17. andinice Says:

    my code is not displaying states at´╗┐ all

  18. auda32 Says:

    so it can be done without including a standalone php file huh? what´╗┐ do you do instead of the posting of the value?

  19. optikalefxx Says:

    the only thing you have to keep in mind, is that the ajax will call a stand alone PHP file. So you either need to know how to begin the MVC to use ajax,´╗┐ or just include the database creds so this can access the joomla db

  20. auda32 Says:

    BTW, what difference does it require to implement this in joomla template file? will it allow´╗┐ to post data to a php file so readily in an MVC framework?

  21. auda32 Says:

    Isn’t a brace “{” after the function (data)´╗┐ missing?

  22. auda32 Says:

    the brace “{“´╗┐ after the function name is missing.

Leave a Reply

*