爲什麼我的方法不能發佈數據? 根據jquery文檔: 「請求方法如何強制jQuery .load()方法使用POST
如果數據作爲對象提供,則使用POST方法;否則,假定爲GET。
var car = {{ car }}
var motorcycle = {{ motorcycle }}
$('.send_data').on('click', function(e){
e.preventDefault();
$('#'+container).load(
$(this).attr('href'),
{ car: car, motorcycle: motorcycle },
function(data) {
$('#'+container).effect('highlight');
}
);
})
那麼源代碼需要什麼改變? – thevangelist
這是jQuery源代碼,所以你不要改變它。你應該檢查'{car:car,motorcycle:motorcycle}'是否是'typeof'對象。據推測,這不是因爲你的方法沒有發佈數據。 –
謝謝,我不小心將其他值作爲非對象 – thevangelist