what is the best ajax approach?
Today , at my home , im using ajax v开发者_C百科ia Jquery like this :
im creating ASCX in the server and the html is with id's and css ids.
now , in jquery i use : $.ajax
... and call to ashx
which render the content of the ASCX
and then injecting it to the page. and from there im using jquery to manipulate operations inside the inejcted content
my friends at work use update panel
what is the best clean 'ajax ' approach.
This isn't really a programming question, but a question about programming.
However, I prefer the JQuery approach, ASP.Net AJAX is easy to use but far less efficient. This is due to ASP.Net AJAX posting the whole section back to the server to get its response.
JQuery is much more finely tuned and gives you the flexibility and agility to only ask for what you need, and only update what you need.
Update panel - no client side coding (for you anyway), very little server side coding, Easier to maintain, less cross-browser headaches. The cost is in efficiency. All of that simplicity costs you flexibility, server cycles, and bandwidth.
jquery/javascript - much more efficient, less server load, less bandwidth. Requires client side coding, more cross browser issues.
It really depends on what your goals are. If your performance requirements allow you to use an update panel, go for it. If you aren't sure, write the same page using both methods and use a program like Fiddler to see the differences in data being sent back and forth.
精彩评论