2017-08-18 35 views
-1

这是我的代码。结果是正确的,并在Chrome和Firefox中工作,但在Internet Explorer中,我变成了beforesend行中的此错误(':'预期)。这个错误会阻止我的脚本。我尝试了一个onload函数document.onload和window.onload,但它不修复这个问题。jQuery.ajax beforeSend错误IE11

jQuery.ajax({ 
     url: '/test', 
     beforeSend(xhr){ 

     }, 
     success: function (data, textStatus){ 
      $('#test2').html(data); 
     }, 
     async: true 
    }); 
+2

:function'在那里。 –

+0

使用与“成功”处理程序相同的格式。 –

回答

0
beforeSend(xhr){ 
-> change in 
    beforeSend: function(xhr){ 

这解决了你需要`问题