Pratik M
Pratik M

Reputation: 39

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

Upvotes: 0

Views: 287

Answers (3)

Lee Mark Smith
Lee Mark Smith

Reputation: 57

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

Upvotes: 0

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

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

Upvotes: 1

thescientist
thescientist

Reputation: 2948

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/

Upvotes: 0

Related Questions