开发者

iPhone web-app parse html with PHP or JavaScript?

开发者 https://www.devze.com 2023-03-12 14:14 出处:网络
I\'m making a web-app for iPhone/iPod touch. And need to load in a external HTML file and parse some d开发者_Go百科ata out of that HTML file.

I'm making a web-app for iPhone/iPod touch. And need to load in a external HTML file and parse some d开发者_Go百科ata 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.


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号