【发布时间】:2011-09-30 18:52:37
【问题描述】:
如何将一些 ajax 数据发布到控制器函数并取回?因为我想向函数发布一个整数,并获得另一个整数(发布 ID 的项目的总票数),并且在成功时我想回显该票数。 我不知道如何将“id”发布到控制器功能。请看我的代码:
//post this integet
the_id = $(this).attr('id');
$.ajax({
type: "POST",
data: the_id,
url: "http://localhost/test/index.php/data/count_votes",
success: function(){
//the controller function count_votes returns an integer.
//echo that with the fade in here.
}
});
【问题讨论】:
标签: php jquery codeigniter post