开发者

jquery ajax 1.4.2's ifModified workaround?

开发者 https://www.devze.com 2023-01-19 23:10 出处:网络
I have a script that looks like this : <script type=\'text/javascript\'> $(document).ready(function(){

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号