ajax不执行success回调而是执行了error回调
ajax不执行success回调而是执行了error回调 最近在看jQuery的API文档,在使用到jQuery的ajax时,如果指定了dataType为json,老是不执行success回调,而是执行了error回调函数 附上代码如下: JScript code: 复制代码 代码如下: $.ajax({ type: "post", url: "jsp/loginManager.jsp", data: "name=" + $('#rname').attr('value') + "&pwd=" + $('#pwd').attr('value'), dataType: "text", success: function(data) { alert(data); } }); 点击登陆,成功连接数据库并且查询到了值(在loginManager.jsp页面有用System.out.print()打印过查询到的值)。但success里的东西不执行。用过断点,当执行完dataType后,success直接跳出,里面的alert()不执行,这是为什么呢? 改了下代码,如下: JScript code: 复制代码 代码如下: $.ajax({ type: "post", url: "jsp/loginManager.jsp", async: true, data: "name=" + $('