开发者

Long HTML Ajax String

开发者 https://www.devze.com 2023-02-05 18:39 出处:网络
I am开发者_StackOverflow中文版 sending a long string (of html) to a browser via ajax. What are my options to make the client download process take less time?You can just sending a value via JSON not f

I am开发者_StackOverflow中文版 sending a long string (of html) to a browser via ajax. What are my options to make the client download process take less time?


You can just sending a value via JSON not full of rendering page. When client has accept the JSON, client will rendering the value. you can using javascript template engine to doing this and one of is http://beebole.com/pure/


Clear out as much whitespace as possible, since it's generally unnecessary anyway. There may other ways to literally reduce the amount of HTML being sent.

Since AJAX calls are asynchronous, you could break the response up into chunks by doing several AJAX calls in close succession, basically allowing for multiple near-simultaneous downloads. It could likely increase the load on the server and require a little bit more intelligent JS and server programming, but if client speed is the main concern, it could be worth it.

0

精彩评论

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

关注公众号