Я хотел бы сделать ajax-запрос, который по-прежнему сохраняет доступ к текущему объекту.Кто-нибудь знает, возможно ли это?
Пример того, что я хотел бы сделать:
function mobile_as(as_object, inputID) {
this.object = 'something';
if (as_object) this.object = as_object;
this.inputID = inputID;
// Get results for later usage.
this.get_results = function(value) {
this.request = $.getJSON("URL", { as: this.object }, function (data) {
// Scope of "this" is lost since this function is triggered later on.
if (data['status'] == "OK") {
alert(this.inputID);
}
});
}
}
}