1
一个简单的调用是这样的:当我尝试jQuery.load()的对象参数金字塔导致“不JSON对象可以解码”
type = 'theType';
category = 'theCategory';
$('#mydiv').load(
'${request.route_url('theUrl')}',
{type:type, category:category}
);
的结果是“没有JSON对象可以解码”错误访问request.json_body
对象。看看请求,我可以看到它是一个POST,X-Requested-With:XMLHttpRequest,并且主体是type=theType&category=theCategory
,这肯定不是JSON。
我在做什么错?
我使用的是金字塔1.3,真子0.72和jQuery 1.7.2
是的,这的确解释。我发现它是违反直觉的,因为$ .ajax确实发送了JSON数据(如果你是'JSON.stringify'的话)。太糟糕了,没有办法告诉jQuery如何编码数据。谢谢。 – Hollister