Reputation: 5010
I want to implement a search input box that when you insert some chars it instantly show below the search results.
Like when you search an user in Facebook Search field at the top of the page, it displays in real time the results.
How can I do that? Can you give me some hints?
Upvotes: 1
Views: 4840
Reputation: 9
Check out django-ajax-search. Works very well and can be fairly customized.
Upvotes: 1
Reputation: 2849
well i used jqueryui autocomplete to make the ajax call and piston to read the models.
Upvotes: 2
Reputation: 13486
Write a view which returns you the results according to query string (GET request) or POST parameter (POST request), depending on what you want. This view should return the results of this query, either rendered as a template for example or in another format (JSON, XML) which you can parse.
On frontend side (Javascript), define a handler which each time you type makes a request to the view above with the stuff which you typed as the query parameters. The callback should then render the results to this view into your page.
Upvotes: 2