which client side architecture should be followed
I am developing a web site in which I am using REST web services, now there are 2 ways of making calls to the REST web services..
1. directly through AJAX
2. AJAX calling a servlet which will in turn make a call 开发者_运维百科to the REST web servicefrom personnel experience I have observed that companies tend to follow the 2 approach...
Is there a reason for following this approach ?? even though we can bring about the same effect by following the first approach with much less coding effort...
Is there an advantage which is being achieved by second approach which I am completely missing ??
Thanks...
The advantage of the second case is you have a back-end process on the data before it hits the front-end. You can manipulate it before it goes to your client, store it and use it for caching and also track analytics on that data. Doing it all on the front-end makes those processes very hard, though it's possible.
Also sometimes you have to manipulate the data so it's easily read on the client. If none of this is important to you, then the first option is the way to go.
精彩评论