Reputation: 39
This is the code . Ajax is only running once when i run in the IE. But with all other browsers it is running great. Untitled Document function cool_add() { //alert(post_id); var txt1 = $("#txt1").val(); $.post('jqueryphp.php', {txt1:txt1}, function(data) { var dat = data; $("div").html(data); }); }
</script>
</head>
<body>
<form>
<input type="text" id="txt1" /><br />
<input type="button" id="butn" onclick="cool_add();">
</form>
<div></div>
</body>
</html>
It is running great in all other browsers but with IE it only runs once thats it.
Upvotes: 0
Views: 1239
Reputation: 79830
IE tends to cache all request and if the request params are same then it will return the cached response. To avoid this, you can use $.ajaxSetup following code which will be applied globally for any future ajax calls.
$.ajaxSetup ({
// Disable caching of AJAX responses
cache: false,
});
You can also apply this cache
on a specific call as below,
$.ajax ( {
//..other params
cache: false,
//..other params
});
When cache=false
, jQuery will add current timestamp to each request so that the request params are unique.
Upvotes: 2
Reputation: 6084
I suspect this is the caching issue I identified in your question yesterday.
Upvotes: 0
Reputation: 34689
In your ajax call, make sure to include
cache: false
IE caches everything, so it assumes your calls are all the same.
Upvotes: 0