读书人

用ajax异步传输不执行success,该怎么

发布时间: 2012-05-20 16:03:12 作者: rapoo

用ajax异步传输,不执行success
$.ajax({
type: "POST",
//contentType: "application/xml",
contentType: "application/x-www-form-urlencoded",
url: "/reg.asmx/UNameExists",
data: { _uname: $('#uname').val() },
dataType: 'xml',
beforeSend: function () {
//$(cid).attr('class', 'load');

// $(cid).show();
},
success: function (result) {
//alert(result);
alert('fff123');

[解决办法]
不执行Success,当然是因为Ajax请求返回了错误,在error中看看错误吧

JScript code
$.ajax({  type: "POST",  //contentType: "application/xml",  contentType: "application/x-www-form-urlencoded",  url: "/reg.asmx/UNameExists",  data: { _uname: $('#uname').val() },  dataType: 'xml',  beforeSend: function () {  //$(cid).attr('class', 'load');     // $(cid).show();  },  success: function (result) {      //alert(result);      alert('fff123');  },  error: function (XMLHttpRequest, textStatus, errorThrown) {      [color=#FF0000]//请求出错处理      //在这里看看出了什么错误 [/color]  } 

读书人网 >asp.net

热点推荐