嗨,我的jQuery回调函数不起作用。jquery post call call not works
Competitor = {
addCompetitorForSave: function($data) {
$.post('/competition/add', $data , function($json) {
}, 'json');
return $json; // I need to return json data .
}
}
此后我需要做下一步。
var data = $('someForm').serialize();
var $json = Competition.addCompetitorForSave(data);
非常感谢。
我需要返回json – Vahan 2012-03-22 15:41:19
您需要等待结果,然后才能对其执行任何操作。 – 2012-03-22 15:42:26
这不会工作得很好。你需要重新考虑你的设计:) – Supr 2012-03-22 15:42:45