【发布时间】:2011-06-28 16:21:17
【问题描述】:
当我尝试从函数返回对象时,我变得不确定。而且我很确定该对象不为空,否则 alert(response.html); 不应该工作。
var Core = {
"Ajax" : function(url, data){
$.ajax({
type: "POST",
url: host + url,
data: data,
success: function(json){
var response = $.parseJSON(json);
if(response.status == "200"){
alert(response.html);
return response;
}
else{
alert(response.html);
return false;
}
},
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
}
});
}
};
【问题讨论】: