简体   繁体   中英

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

问题是关于我的服务器端结构,仅与ie8不相关。

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);
...

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