我希望AJAX回調觸發myFucntion中的alert(),它的工作原理是如何在ajaxResponse中引用myobject對象?將對象傳遞給onreadystatechange
function myobject(){
this.val="worked";
http.onreadystatechange =function ajaxResponse() {
if (http.readyState == 4) {
this.myFunction();
}
http.send(null);
}
myobject.prototype.myFunction=function(){
alert("it "+this.val);
}
你的問題是什麼? – sinsedrix 2012-02-14 14:07:58
我的問題是如何在ajaxResponse中調用this.value並引用包含此代碼的對象中的值。 – user1209203 2012-02-14 14:37:10