this.getFullAddress(id).done(function(data) {
// need to have both the response (data) and the id
});
getFullAddress(id) {
var response = $.ajax({
url: 'http://whatever.com'
}); // modify this (add id)
return response;
}
有谁知道如何做到这一点?
答案 0 :(得分:0)
好的,找到了:
getFullAddress(id) {
$.ajaxSetup({
dataFilter: function (response) {
response = JSON.parse(response);
response['id'] = id;
response = JSON.stringify(response);
return response;
}
});
return $.ajax({
url: 'http://whatever.com'
});
}