繁体   English   中英

IE中的Jquery Ajax仅运行一次

[英]Jquery Ajax in Ie runs only once

我的代码我已将cache:false设置为仍在IE中运行一次。 请帮我。

<script type="text/javascript" src="javascripts/jq1.7.js"></script>
<script type="text/javascript">
  $(document).ready(function(){
    $("#butn").click(function(){
      var txt1 = $("#txt1").val();

      $.ajax({
        type: "Post",
        url: "jqueryphp.php",
        dataType: "html",
        data: "txt1="+txt1,
        cache: false,
        success: function(result) {
          $("div").html(result);
        }
      });
    });
  });
</script>
</head>
<body>
  <form>
    <input type="text" id="txt1" /><br />
    <input type="button" id="butn">
  </form>

请帮助我,我被困在这里。 它可以在除IE之外的所有浏览器上正常运行

尝试类似的方法:


$.ajaxSetup({
  cache: "false"
   });
$.ajax({
   type: "POST",
   url: "jqueryphp.php",
   data: "txt1="+txt1,
   cache: false,
   success: function(result){
     $("div").html(result);
    }
 });

希望能帮助到你

IE浏览器是贪婪的。 考虑为每个URL添加一个时间戳。 这里还有其他一些选择。 http://formatinternet.wordpress.com/2010/01/14/ie-cache-for-ajax-requests/

确保进行调用的文件具有正确的doctype和xmlns声明。

为调用中涉及的元素分配xmlns ID

例:

还可以使用:jQuery.post('call.php',{action:“ get”}

在此处找到完整的教程: http : //vavumi.com/?p=257

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM