IE8 Submits the form but sometimes doesn't refresh the page
I have a button and when I click that button a function works, it calls jQuery .submit function.
I use jQuery 1.4.2.
However, sometimes it submits but doesn't refresh the page. I got this problem just on IE8.
Actually i开发者_开发技巧t works on IE8 but sometimes I get this problem and sometimes not.
My page is like that; there are some text fields and a chechboxes near every text field. I check the checkbox and push the delete button, it submits the value and that text field disappear(it is deleted at server side and the page reloads all the text fields that saved at server side). The problem is that sometimes that textfield doesn't disappear from the screen but if I re-enter page's url and push enter or F5 the page or check the checkbox and push the delete button again everything works fine...
Sounds like browser caching issue. To solve this, when you submit the form add random value to its action
, thus tricking the browser to think it's different page so it won't load the contents from its cache.
Sample code:
var rand = parseInt(Math.random() * 1000000 + 100000);
$(form).attr("action", "mypage.php?r=" + rand);
...
Problem was about my server side structure, was not related to only ie8.
精彩评论