Question

I'm making a web-app for iPhone/iPod touch. And need to load in a external HTML file and parse some data out of that HTML file.

I can do this on the server (on a separate page) and echo the data with json. Then I load that page with AJAX after the web-app is loaded.

But I can also load the complete HTML file with AJAX and parse the HTML to data with JavaScript.

Which option would be faster?

PS: There's no option to load the html file and parse it while you "load" the web-app. The web-app must be dynamically changing itself while already loaded. So having a possibility to refresh the data without restarting the web-app.

Was it helpful?

Solution

Loading the JSON from an AJAX call would be faster than parsing an HTML file in JavaScript (Since JSON is "near-native" in JS).

NOTE: To qualify this answer, it would be faster for the client (iPhone/iPod).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top