$.ajax({
type: "POST",
data: {data:the_id},
url: "http://localhost/test/index.php/data/count_votes",
success: function(data){
//data will contain the vote count echoed by the controller i.e.
"yourVoteCount"
//then append the result where ever you want like
$("span#votes_number").html(data); //data will be containing the vote count which you have echoed from the controller
}
});
in the controller
$data = $_POST['data']; //$data will contain the_id
//do some processing
echo "yourVoteCount";
Clarification
i think you are confusing
{data:the_id}
with
success:function(data){
both the data
are different for your own clarity sake you can modify it as
success:function(vote_count){
$(span#someId).html(vote_count);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…