日期:2014-05-17  浏览次数:20420 次

用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]
  }