这是我的代码。 结果是正确的,可以在Chrome和Firefox中工作,但在Internet Explorer中,我在Beforesend行中成为此错误(":"预期(。 此错误阻止了我的脚本。 我尝试使用onload函数document.onload和window.onload,但它不能解决这个问题。
jQuery.ajax({
url: '/test',
beforeSend(xhr){
},
success: function (data, textStatus){
$('#test2').html(data);
},
async: true
});
beforeSend(xhr){
-> change in
beforeSend: function(xhr){
这解决了问题