私はオブジェクトmyObject
を持っていますが、内部にはという機能があります。$.ajax({
にはcomplete: function(xmlHttp){
があります。この関数の中では、myObject
で定義されているsetResultを呼び出す必要があります。どうやってするか?jQueryを使用したJavaScript OOP
function myObject() {
this.setResult = setResult;
function setResult(result) {
this.result = result;
}
function execute() {
$.ajax({
complete: function(xmlHttp){
(?) setResult(jQuery.parseJSON(xmlHttp.responseText));
}
});
}