在前端通過ajax請求後臺之後返回的時候,出現了下面的異常:
error: function(req, textStatus, errorThrown){}
req:
textStatus:"parsererror";
errorThrown:undefined.
而自己的ajax請求如下:
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(dataModel.dataSource()),
url: url1,
async: false,
dataType: 'json',
解決方案:將dataType註釋掉就可了,原因是我的返回值是一個字符串而不是一個對象~~