Ajax错误,对象函数绑定没有方法'Ajax '


Ajax error, Object function bound has no method 'ajax'

我有一个简单的Ajax请求,但由于某种原因它给出了一些错误。我不知道这个错误是什么意思:

TypeError: Object function bound(var_args) { return func.apply(thisObject, args.concat(slice(arguments))); } has no method 'ajax'

试图访问PHP函数获取数据

这是ajax请求本身:

$.ajax({
    type: 'POST',
    url: 'http://me.mydomain.com/get-ajax.php',
    data: {
        'action': 'request',
        'id': 314
    },
    dataType: 'json',
    success: function(data) {
        console.log(data['post']);
    }
}); 

确保你的jQuery脚本加载当你做这个ajax调用,如@mesutozer说,如果没有帮助,那么我假设你有一些额外的javascript可以使用$ shortcut所以尝试jQuery.ajax({…})而不是

将$括起来。jQuery的document ready回调函数中的ajax调用,以确保它在jQuery加载时执行

$(document).ready(function (){
  $.ajax({
    type: 'POST',
    url: 'http://me.mydomain.com/get-ajax.php',
    data: {
        'action': 'request',
        'id': 314
    },
    dataType: 'json',
    success: function(data) {
        console.log(data['post']);
    }
  }); 
});

我猜你的jquery是冲突的。尝试——

$m=jQuery.noConflict(); // write it at the top
$m.ajax({
    type: 'POST',
    url: 'http://me.mydomain.com/get-ajax.php',
    data: {
        'action': 'request',
        'id': 314
    },
    dataType: 'json',
    success: function(data) {
        console.log(data['post']);
    }
});