jquery pagination+jquery ajax =? asp.net update Panel
several times ago, I researched to fill in a table with ajax method. My first aspect was to fill in table with jquery ajax method, and second using update method. I wanted also to use the pagination. That's why, I had combined jquery pagination with jquery ajax. That's worked prerfectly. Although the amount of data being fetched from database is too small, the jquery method took time approximately 0.5s, while asp.net update Panel method required just 0.2s. In this case, I had choosed, of course, update Panel. However I was not sure due to many documentation against to updatePanel.
So my question is so simple after my history : "Is jquery(ajax+pagination) method for the mamoth amount of data appropriate?
UpdatePanel loading duration :199 ms the loading duration of jquery ajax method :538
with loading duration I mean getting data from database. Rendering Time is pretty low.
I want to also add my jquery ajax code:
function getadvert(page_index){
$.ajax({
type: "POST",
url: "SearchAdvert.aspx/getAdverts",
data: "{pageNumber:'"+page_index+"'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg){
$.each(msg.d, function(i){
$("#Searchresult").append("<div class='advertbox'><div class='image'></div><div class='text'>"+this.header+"</div></d开发者_运维百科iv>");
});
}
});
}
The thing is, the UpdatePanel works well when you want to do everything on the server, so you can have one set of code and don't have to write a lot of JavaScript. But, if you plan on building your UI's in client-side JavaScript either using JQuery, a plugin, or your own code, it's better to stick to the JQuery AJAX approach.
Additionally, the UpdatePanel posts back the entire viewstate and any update panel data, and renders the replacements appropriately, so there is much more data going across the wire. You're gaining convenience and everything still happening on the server as the benefit.
HTH.
精彩评论