2
我已经通过几个教程关于使用jQuery AJAX张贴在网络上阅读,他们都来自web服务引用响应对象响应/ response.d - 这使我相信这是JQuery响应处理程序的内置对象。jQuery和阿贾克斯 - 在着手
代码段:
$('.submit').click(function() {
var theURL = document.location.hostname + ":" + document.location.port + "/LeadHandler.aspx/hello"; // this will change too
alert(theURL);
$.ajax({
type: "POST",
url: theURL,
data: "{'NameFirst':'" + $('#txtFirstName').val() + "'}", // again, change this
contentType: "applications/json; charset=utf-8",
dataType: "json",
success: alert("Success: " + response.d), // this will change
failure: function (response) {
alert("Failure: " + response.d);
}
});
});
但是代码返回:在Chrome的JavaScript控制台 “未捕获的ReferenceError响应没有定义”。我做了什么假设,我需要重新评估。
*迂回响应*为了让它得到验证,代码需要回答,在成功函数{}的右括号后面, – lazyPower 2011-01-20 18:39:15