How can i post some ajax data to the controller function and get it back? For I want to post one integer to the function, and get another integer (total votes for the item which ID is posted), and on success i want to echo that vote count. I dont know how can i post the "id" to the controller function. Please see my code:
//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.
}
});