我希望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