Solution to Ajax aborted error request interrupt in IE6

Time:2021-9-17

A click event is bound to the a tag to trigger Ajax requests. In IE6, requests are often interrupted, and everything is normal in other browsers.

When fiddler2 and httpwatch are used to monitor requests in IE6, there is often “aborted“, which has been tossed for a long time, which is quite strange. Later, the a tag was replaced with a button, and the request was normal. Finally, after being reminded, it may be that the default event of the a tag interrupted the request. However, in HTML code, the href of a tag has been set to “javascript: void (0)”, which usually prevents the default event (page Jump). The click event of a tag will be executed first, and then the jump of href will be executed. If href is a JavaScript statement, it will be executed at this time. IE6 interrupts the Ajax request triggered by click when executing a href JavaScript statement. Href = “javascript: void (0)” is used to block the default event. Move the action to block the default event to the click event to solve the problem, so that the JavaScript statements in href will not be executed.

Note: add onclick =’return false; ‘to a, It can also solve the problem.