I have a script that looks like this :
<script type='text/javascript'>
$(document).ready(function(){
setInterval(f开发者_如何学Gounction() {
$.ajax({
url: "../Ps/th.php",
ifModified:true,
success: function(data, textStatus){
if(textStatus!="notmodified") {
$("#display").append(data);
alert(textStatus);
}
}});
},1000);
});
</script>
and corresponding php is just this :
<?php
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT, true, 304");
echo "shrinath<br>";
?>
the ifModified header seems to be not working as documented (known bug/whatever).
How do i make sure that the ajax doesn't append the data if it is not changed ?
its a bug in 1.4.2 : http://forum.jquery.com/topic/jquery-1-3-2-update-to-1-4-2-ifmodified-option-doesn-t-still-work
EDIT : hey i think php script is wrong check it out here : http://helpdesk.toitl.com/?w=ajax_ifModified check the loaded.php and index.html on the top right corner
精彩评论