如何将一些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.
}
});
Run Code Online (Sandbox Code Playgroud) 我想在屏幕上居中一个div,这样当页面向下/向上滚动时,div会平滑地滚动到页面的中心.我正在尝试这个代码(请参阅jsfiddle),但不起作用.有人可以帮我吗?谢谢.