내가 캐시 자신을 처리 할 것
: 요청에 말했다 경우,
// declare this on global scope
var ajaxCache = {};
...
if (!ajaxCache[this.id]) {
ajaxCache[this.id] = $.ajax({
type: "POST",
url: "get_note.php",
data: {'pid':'<?php echo $project_id;?>','record_id':this.id}
});
}
ajaxCache[this.id].done(function(){
if (data != '0') {
// Add dialog content
$('#note_container').html(data);
$('#note_container').dialog();
} else {
alert('woops');
}
});
이 방법을 당신은 같은 캐시 매개 변수를 추가해야
var postdata = {'pid':'<?php echo $project_id;?>',
'record_id':this.id};
$.ajax({
type: "POST",
url: "get_note.php",
data: postdata
}).done(function(data){
if (data != '0') {
// Add dialog content
$('#note_container').html(data);
$('#note_container').dialog();
} else {
alert(woops);
}
});
downvote의 이유는 무엇입니까? 이 대답은 유용하지 않았습니까? – AlienWebguy
브라우저는이를 허용하면 캐싱을 처리합니다. EXACT 동일한 요청을 두 번 시도하면 자체 캐시가 사용됩니다. 브라우저가 캐싱을 처리 할 때 바퀴를 다시 만드는 이유는 무엇입니까? – Adam
잘 모르겠습니다. 나에게 좋은 개념 인 것 같습니다. 요소에 저장하면 jQuery로 요소를 제거하면 자동으로 정리됩니다. –