By Harry Fuecks

Server Side Autocompletion with PHP and XMLHttpRequest

By Harry Fuecks
Help us help you! You'll get a... FREE 6-Month Subscription to SitePoint Premium Plus you'll go in the draw to WIN a new Macbook SitePoint 2017 Survey Yes, let's Do this It only takes 5 min

Christian has an interesting new feature called “Livesearch” on his blog, described here. Try typing “PHP” in the search box on the right and see what happens.

On the client side it’s made possible with – you’ll see it using XMLHttpRequest to poll another PHP script that looks like – the script renders search results as HTML which is easily “embedded” in the output with some DOM manipulation.

This is the kind of thing I was trying to describe in Separating Browser from Resource.

Think Christians example proves that this approach can be fast and effective – if you didn’t look you’d assume the search results were sent with the page on the initial request, rather then being rendered dynamically.

Login or Create Account to Comment
Login Create Account
Get the most important and interesting stories in tech. Straight to your inbox, daily.Is it good?