I have a demo use jquery ajax post. It can run on Chrome and Firefox, but not in IE10. This is my demo: http://jsfiddle.net/44T5D/. Please help me to solve this problem. Thanks for you help.
The code:
$(function() {
$('.document').on('click', '.ajax', function(e) {
e.preventDefault();
// ajax request
$.ajax({
async: true,
cache: false,
type: 'post',
url: '/echo/html/',
data: {
html: '<p>This is echoed the response in HTML format</p>',
delay: 1
},
dataType: 'html',
beforeSend: function() {
console.log('Fired prior to the request');
},
success: function(data) {
console.log('Fired when the request is successfull');
$('.document').append(data);
alert(data);
},
complete: function() {
console.log('Fired when the request is complete');
}
});
});
});
Internet Explorer will error on the various console
functions unless the developer tools are open. As you have a beforeSend
handler, more than likely that's where it's stopping execution.
To see if this is indeed the issue, press F12 to open up the developer tools and refresh the page, and see if it works.
As a workaround if you want to keep the console
functions, look into a console polyfill (some are listed here): Why do console.log() polyfills not use Function.apply()?