Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Populating ajax cascading dropdowns from XML

is it possible to do this?

7:03 am on Dec 19, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 26, 2006
votes: 3

I'm familiar with XML for data feeds etc, but have never used it for our actual site. Currently we have 3 dependent dropdowns that are just using javascript to pull the dependencies....

I was thinking the other night, wouldn't it be great to just have a flat xml file for this type of implementation with ajax and save ourselves the server load on queries, but I don't even know if this is possible.

If it is possible, does anyone have an example...

Sadly I'm not using PHP on this project, it's classic asp/vb
1:53 pm on Jan 16, 2013 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 29, 2003
votes: 0

If you're preloading the data to populate the dropdowns, then I'd define the dependencies using JSON, not XML. Just make a big object and then access parts of the object to create your <option> nodes.

In the case you're doing AJAX to get the dropdown contents, reading and grabbing data from a large XML file will be slower than getting the same info from a similarly-sized SQL table.

In either case, caching the AJAX output in something like Redis or Memcached will provide speed.