PDA

View Full Version : AJAX using a big XML file a good idea?


coasters2k
07-17-2006, 10:54 PM
I'm designing a script that a user enters a zip code and the page then fetches and dynamically displays another PHP page that says the location info (city/state) for that zipcode...

Instead of doing it that way I was thinking of creating a XML file and having it return the info from that file instead (for true AJAX style), however the XML file would well be over 2mb probably (thats the size of the mySQL zipcode database) and have over 40k records.

So is making my AJAX script call a 2MB XML file a bad idea? Does the end user have to download the entire XML file and process it in whole (if so it'd definitely not be a good idea) or should I just stick to what I already have in mine, querying the database and printing the info on another page and inserting that page into the current one with the innerhtml stuff...? I guess my question has to do with my ignorance of AJAX and XML's inner workings. Thanks!

Beagle
07-17-2006, 11:38 PM
If you request a file, you will be served that file. So if you request a 2MB XML file, you will receive a 2MB XML file. If on the other hand you request a PHP page and the total output it produces is 15KB, you will receive all 15KB.

XML is bloated, if you don't need all of it's features, don't use it.

Webgirl
07-31-2006, 12:36 AM
But my God 2MB of XML is too much, I would abort it if something that big was downloading - I hope I m not sounding ignorant. :( :eek: