0
我想在Ajax中使用POST方法获取JSON数据。我用下面的代码来获取数据,但它给像在Ajax中的POST方法给出错误'非法调用'?
TypeError: Illegal invocation
http://mylocalhost.com/statics?action=retrive&table=log
在上面的链接我JSON格式得到了数据错误。这里mylocalhost.com被我的IP和端口号取代。
var domain_url = "http://mylocalhost.com/statics";
var obj = {
action: 'retrive',
table: 'log',
dataType: 'json',
processData: false,
limit: 20,
option: {_id: {$lt :id}}
};
console.log(obj)
$.ajax({
url: domain_url,
type: 'POST',
data: obj,
success: function(data, res){
console.log(data)
},
error: function (errorThrown, res)
{
}
});
哪条线发生错误? – Barmar 2014-10-07 14:09:22
我认为这可能与'option:{_id:{$ lt:id}}'有关。我不认为你可以传入嵌套对象作为数据对象的一部分。每个值都需要是一个字符串。 – Andy 2014-10-07 14:10:17
变量'id'中的内容是什么?那是你的问题。 – epascarello 2014-10-07 14:16:22