日期:2014-05-16  浏览次数:20693 次

$.ajax({ 对象不支持此属性或方法
 
  $.ajax({
  //type: "POST",
  url: "Ajax/userLogin.ashx?user=" + uName + "&pass=" + uPwd+"&chk="+chk+"&flag="+flag,
  success: function(data) {
  if (data == "OK") {
  alert("OK");
  }
  else {
  alert("OK");
  return false;
  }
  },
  error: function() {
  $.messager.alert('错误', '登录出错', 'error');
  $("#btnEp").linkbutton({ disabled: false });
  }
  });
/*
  $.ajax({
  type: "POST",
  dataType:"Text",
  url: "Ajax/userLogin.ashx",
  data: { user: uName, pass: uPwd, chk: chk, flag: flag },
  //beforeSend: function() {
  // $("#ds").html("loading");
  //},
  success: function(data) {
  if (data != "") {
  if (data == "OK") {
  alert("asdf");
  }
  else {
  alert(data);
  return false;
  }
  }
  }
  });
  */
为什么老提示 $.ajax({ 对象不支持此属性或方法
jquery.js也引进了,不好意思,本人穷程序员,没有分

------解决方案--------------------
有没有引用别的js文件,有可能代码冲突,$的定义被覆盖了。
------解决方案--------------------
jQuery(function($){
$.ajax({
//type: "POST",
url: "Ajax/userLogin.ashx?user=" + uName + "&pass=" + uPwd+"&chk="+chk+"&flag="+flag,
success: function(data) {
if (data == "OK") {
alert("OK");
}
else {
alert("OK");
return false;
}
},
error: function() {
$.messager.alert('错误', '登录出错', 'error');
$("#btnEp").linkbutton({ disabled: false });
}
});
/*
$.ajax({
type: "POST",
dataType:"Text",
url: "Ajax/userLogin.ashx",
data: { user: uName, pass: uPwd, chk: chk, flag: flag },
//beforeSend: function() {
// $("#ds").html("loading");
//},
success: function(data) {
if (data != "") {
if (data == "OK") {
alert("asdf");
}
else {
alert(data);
return false;
}
}
}
});
*/
})


试试


是不是 页面中 有 $ 与 jquery的$ 冲突了。