次のように、2 つのメソッドを持つオブジェクトがあります。
function PendingRequests(){
this.count;
this.id = [];
this.event = [];
}
PendingRequests.prototype.get = function(){
var request_parameter = 'cont=pr';
Ajax(url,request_parameter,this.get2);
}
PendingRequests.prototype.get2 = function(pr){
this.count = pr.length;
for(var i=0;i<this.count;i++){
this.id[i] = pr[i]['id'];
this.event[i] = pr[i]['event'];
}
}
var pendingrequests = new PendingRequests();
そしてajax関数
Ajax(url,parameter,funct){...}
応答を取得した後、渡された関数を呼び出します
funct(JSON.parse(XMLHttpRequestObject.responseText));
スクリプトは、ajax 応答後にメソッドを呼び出すまで実行されますが、「this.id is undefined」というエラーが表示されます
これを手伝ってください。