开发者

What to have in mind when building a AJAX-based webapp

We're in the first steps of what will be a AJAX-based webapp where information and generated HTML will be sent backwards and forwards with the help of JSON/POST techniques.

We're able to get the data out quickly without putting to much load on the database with the help of a cache-layer that features memcached as well as 开发者_如何学Cdisc-based cache. Besides that - what's essential to have in mind when designing AJAX heavy webapps?

Thanks a lot,


Probably the best thing to have in mind is that your app shouldn't be AJAX-based. It should work fine if the user's browser has scripts disabled. Only then should you start layering on AJAX. Stackoverflow is a great example of this. AJAX really improves the experience but it works when it's disabled.

Another thing I like to do is to use the same PHP validation functions for both server-side and client-side validation (as in sending an AJAX request to a script containing the same PHP function) to keep the amount of cross-language code duplication to a minimum.

Read up on Degradable AJAX.


Security for one. JavaScript has a pretty notoriously bad security profile.


These are the two that always get me:

  1. What happens when the user clicks multiple items that may trigger multiple requests that may return out of order?

  2. What happens when a request doesn't come back for one reason or another (timeout, server problem, etc.)? It always happens eventually, and the more gracefully your system fails the better.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜