makeRequest(where, data, type?) {
if (!type) {
type = 'GET';
}
$.ajax({
method: type,
url: baseaseUrl+where,
data: data,
success: function (msg) {
console.log('ajax: ', msg);
return msg;
},
error: function (a, b, data) {
console.log(b + ' ' + data);
},
statusCode: {
418: function(status) {
console.log('418: ', status.status);
return makeRequest(where, different_data);
}
}
});
}
此代码摘自离子框架项目。如果第一个(初始)请求返回某个(例如418)http状态代码,我想在ajax请求中发出另一个请求。当我打电话给" makeRequest()"它返回418状态代码,这没关系,然后当我用不同的数据发出第二个请求时,我得到:
ERROR RangeError: Maximum call stack size exceeded
at Function.jQuery.extend.jQuery.fn.extend (vendor.js:1)
at Function.jQuery.extend.jQuery.fn.extend (jquery.js:250)
at Function.jQuery.extend.jQuery.fn.extend (jquery.js:250)
at Function.jQuery.extend.jQuery.fn.extend (jquery.js:250)
at Function.jQuery.extend.jQuery.fn.extend (jquery.js:250)
at Function.jQuery.extend.jQuery.fn.extend (jquery.js:250)
at Function.jQuery.extend.jQuery.fn.extend (jquery.js:250)
at Function.jQuery.extend.jQuery.fn.extend (jquery.js:250)
at Function.jQuery.extend.jQuery.fn.extend (jquery.js:250)
at Function.jQuery.extend.jQuery.fn.extend (jquery.js:250)