I am using the jquery $.Ajax property for getting some data from database as json and manipulating dom with that.
For example like this:
$.ajax({
type: "POST",
url: "TipsAndTricksService.asmx/postCommentForTT",
data: "{'ttID':'" + ttID + "','text':'" + answerText + "','authorOfTT':'" + authorOfTT + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(message) {
var a=message.d;
var newCommentDiv = document.createElement('div');
newCommentDiv.setAttribute('id',a.answerID+"_commentTT");
newCommentDiv.setAttribute('class',"answerDivStyCom");
var html = "<div class='leftUp'>"+
"<img alt='profilePic' src='images/profilepics/" + a.authorID + "_2.png'/>" +
"</div>"+
"<div class='middleUpStyCom'>"+
"<div class='middleUpUpStyCom'><a href='ProfileMain.aspx?pid=" + a.authorID + "' >" + a.authorName + " " + a.authorSurname + "</a></div>" +
"<div class='middleUpMiddleStyCom'>"+a.authorJobname+"</div>"+
"</div>"+
"<div class='leftDownStyCom'>"+
"<div class='leftDownUp'>+Şikayet Et!</div>"+
"</div>"+
"<div class='middleDownStyCom'>"+a.text+"</div>"+
"</div>";
newCommentDiv.innerHTML=html;
$(myDiv).parent().parent().prev().append(newCommentDiv);
$("#"+a.answerID+"_commentTT").hide().fadeIn(1000);
$(myDiv).prev().children("textarea").val("");
}
});
As you see: the url is a webservice function and it works fine.
The question is :
- Is caching a default property of jquery ajax post request? if so how can i test it?
- If not a default property, is there a good and safe plugin f开发者_开发知识库or that ?
Thanks
Caching "POST" requests is kind-of weird, and your browser won't want to do it because a "POST" is supposed to mean that you are doing something actively on the server. For "GET" requests, things are cached the same way the browser caches anything else, with the exception that jQuery will modify your "GET" URLs with dummy parameters if you tell it to (the "cache" property you pass in the argument object to "$.ajax()").
What sort of caching are you talking about? It would help to know that.
精彩评论