0
Edit box onchange search query auto apply
any certain that editbox can auto search query upon onchange values
7 Réponses
+ 2
if you want to search while the user is still typing the word, you will need Ajax.
because PHP is running in the Webserver you cannot change the content of the website natively. With Ajax JavaScript will send (e.g. a SQL querry) and receive data while the user is typing. This data can be displayed in the webside using DOM.
Hope that helps. For more information you can contact me.
0
..can you share some particular code using AJAX
0
To see Ajax in complete action you need more as only some particular code. Sorry...
First you need a html website, second some JavaScript in it and in the backend something like a webservice which will deliver you the data you want to load in the background. Sometimes JSON is used here to format the data.
So the trick is, that you define a special event (maybe two or more letters are typed in a input field). This event is recognized by JavaScript on your HTML. Now the JavaScript take the value of this input field and send this to your "backend". There, e.g. a php-File takes this value and make some calculations or sql-query and send the result back to your html/JavaScript site in JSON-Format.
The JavaScript now replaces the InnerText Value of every DOM-Element you like. The clue is, that the website does not have to be reloaded and no form has to be send by the user, because the trigger to request the data is the event.
I would like you to see here for more information.
http://www.w3schools.com/xml/ajax_intro.asp
0
I already got this one but i need few codes than this large one.
0
Hi Gerome,
if you look at my codes you will find two files. One php (the backend) and one main.html.
Hope you will get a clue now.
0
@jmey tnx for this .but is there no other way than that calling AJAX..no 3rd party just PHP itself
0
what kind of third party did you mean?
Ajax is a technology not a language.
what kind of datasource you refer to doesn't matter.You could also send Data to an ASP vor something that answers on a http request.