重複の可能性:
jquery は親から this を参照します
これは私の最初の投稿です。質問 - ajax-success からアラートを呼び出す方法は?
var page = {
alerts: function (json) {
if (json == 'us') { alert("blablabla") } else {
alert(json.login);
}
},
ajax: function (obj) {
$.ajax({
type: 'post',
url: './scripts/serv.php',
dataType: 'json',
data: { object: $.base64.encode(JSON.stringify(obj)) },
success: function (json) {
// how to call from here alerts(json)?? this.alerts(json) - doesn't
// work only page.alerts(json) but i think its wrong way.
},
error: function (json) {
alert('ajax failed');
}
})
}
}