简体   繁体   中英

Jquery Ajax in Ie runs only once

My code i have set cache :false still in IE it runs only once . Please help me.

<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>

Please help me with this i am stuck here. It runs properly on every browser except IE

Try something like:


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

Hope it helps

IE is cache greedy. Considering adding a timestamp to each URL. Here are some other options too. http://formatinternet.wordpress.com/2010/01/14/ie-cache-for-ajax-requests/

Make sure the file making the call has a proper doctype and xmlns declaration.

Assign a xmlns id to the elements that are involved in the call

example:

also use: jQuery.post('call.php',{ action: "get"}

find the full tutorial here: http://vavumi.com/?p=257

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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