1
为什么当Ajax调用返回值时,此脚本会导致'undefined'?使用Ajax.Request返回值
function myShippingApp() {
this.shipper = 0;
this.init() {
this.getShipRate();
alert(this.shipper);
}
this.getShipRate = function() {
var zip = $('zip').value;
if(zip == '') {
return false;
} else {
var url = 'getrate.php?zip='+zip;
this.shipper = new Ajax.Request(url, {
onComplete: function(t) {
$('rates').update("$"+t.responseText);
return t.responseText;
}
});
}
}
}
我与原型框架内工作,并且有麻烦返回值回对象。 我在做什么错?
谢谢!
重复http://stackoverflow.com/questions/1005942/get-ajax-response/1005987 – Surya 2009-06-22 21:31:10