Situation
I have a client/friend whose website needs a search page. That bit's fine, but the fields need to be able to populate themselves with the current contents of the database.
So if we imagine it's a car site, for instance. We look down the 'Make' dropdown box and see:
Citroen (11)
Nissan (25)
Peugeot (14)
Toyota (3)
Vauxhall (10)
Select 'Air-Con: YES' and the list changes to:
Citroen (2)
Peugeot (5)
Toyota (3)
And that happens with all fields. The Autotrader website is a great example.
Repopulating the dropdown lists via javascript is fine, generating the necessary SQL queries using PHP is fine.
PROBLEM = Getting the PHP results into Javascript without reloading the page.
Could someone more au fait with JS gimme a hand here? My plan originally had been to load a txt file and get JS to parse it, but it turns out JS can't do that exactly. So the next option was to get PHP to generate a full includable script, but that's proving troublesome as well.
XML has come up a few times in my searches. What are your thoughts?
Yeah - is Ajax built into browsers, or is it a set of externally defined functions that I need to include? Also, are there any key browsers that don't support it (e.g. IE, Firefox, Safari, Netscape, Opera)?