我需要将数据对象中传递一个对象,但它不工作jQuery的AJAX:在数据对象的对象
我用下面的函数我在这个非常网站,很实用,表单数据转换成JSON
发现$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
然后我需要传递该对象作为子对象,但它不工作。过滤器甚至没有显示出来查询字符串参数在检查
var filters = $('.filtersForm').serializeObject();
$.ajax({
type: 'GET',
data: {script:'search',page:page,filters:filters},
success: function(data){
}
});
查看如何“过滤器”中缺少图片
是否有人可以解释为什么我不能传递这样的对象?
为什么会倒下投票? –
您使用此serializeObject函数而不是JSON.stringify()的任何特定原因? – Jon