我有 mockjax 代码,它给了我错误。这是我的代码
$.mockjax({
url: '*',
responseTime: 2000,
response: function (settings) {
var query = settings.data.query,
queryLowerCase = query.toLowerCase(),
re = new RegExp('\\b' + $.Autocomplete.utils.escapeRegExChars(queryLowerCase), 'gi'),
suggestions = $.grep(countriesArray, function (country) {
// return country.value.toLowerCase().indexOf(queryLowerCase) === 0;
return re.test(country.value);
}),
response = {
query: query,
suggestions: suggestions
};
this.responseText = JSON.stringify(response);
}
});
这是我的ajax代码
$.ajax({
async: false,
url: 'coments.php?id='+$('#id').val()+'&cmnt='+$('#cmnt').val()+'&type=2',
success: function(data) {
alert('saved');
}
});
TypeError: settings.data is undefined
当我检查控制台时它给了我错误