首页 > 其他 > 详细

has no method 'ajax'

时间:2014-03-27 00:24:13      阅读:599      评论:0      收藏:0      [点我收藏+]

今天弄好久。直接拿例子吧。

function addWatchItem(param1,param2){
$.ajax({
url : ‘addWatchItem.html‘,
data : {auctionItemId: param1, flag:param2},
success : function(data){
if(data=="error"){
alert("内部错误!");
return false;
}

}
});
}

按照我们的写法习惯。我写成了$.ajax  但是一直报错。。包的错误为has no method ‘ajax‘    

Uncaught TypeError: Object #<Object> has no method ‘ajax‘

后来在google上查找

Looking at the definition of $ in your code, it seems like you‘re using the Prototype framework as well. A problem when using multiple libraries is that they are overwriting variables, mainly the $.

In your case, use jQuery instead of $ (so jQuery.ajax(...)), or use jQuery.noConflict to restore the $ back to the jQuery one.

将如上代码 中的$改为 jquery

即:

function addWatchItem(param1,param2){
jquery.ajax({
url : ‘addWatchItem.html‘,
data : {auctionItemId: param1, flag:param2},
success : function(data){
if(data=="error"){
alert("内部错误!");
return false;
}

}
});
}

神奇的好了。


has no method 'ajax',布布扣,bubuko.com

has no method 'ajax'

原文:http://blog.csdn.net/baicp3/article/details/22200529

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!