Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery Ajax DOM异常12_Jquery_Ajax_Exception_Dom - Fatal编程技术网

jQuery Ajax DOM异常12

jQuery Ajax DOM异常12,jquery,ajax,exception,dom,Jquery,Ajax,Exception,Dom,我正在尝试使用发送get请求 $.get('/').done(function() { alert('assdsdasasd'); }).fail(function(jqXHR, textStatus, errorThrown) { alert(errorThrown); }); 但是失败处理程序被调用,它会提醒我“Error:SyntaxError:DOM异常12” 此错误来自何处?如何解决此问题?当接收的数据不是预期格式时,通常会出现此错误。例如,格式错误的HTML或JSO

我正在尝试使用发送get请求

$.get('/').done(function() {
    alert('assdsdasasd');
}).fail(function(jqXHR, textStatus, errorThrown) {
    alert(errorThrown);
});
但是失败处理程序被调用,它会提醒我“Error:SyntaxError:DOM异常12”


此错误来自何处?如何解决此问题?

当接收的数据不是预期格式时,通常会出现此错误。例如,格式错误的HTML或JSON。@Rorymcrossan不幸的是,发送请求的资源没有出现在Safari的开发控制台中。我如何调试这个?顺便说一句:dataType通常设置为Intelligent Guess,不是吗?是的,尽管它基于返回数据IIRC的前几个字符。因此,如果它认为响应是JSON,但存在格式错误,您将看到此错误。尝试使用Chrome DevToolsHanks,这对我很有帮助。