change the html of div tag using jquery ajax in codeigniter [closed]
hi i am new at codeigniter. i want to change my div tag using jquery ajax.
As per your comment your current code seems to be like this -
function submitVote(frmName){
$.ajax({
type: "POST",
url: "<?php echo SITEURL; ?>/community/community/add_vote/?",
data: "vote="+the_value+"&poll="+poll,
success: function(msg){
alert(msg);
}
});
}
First thing i would like to add is from where are you getting the the_value
and poll valuesenter code here
? Because you have mentioned nowhere regarding this in your code.
secondly there is no need to send ?
in your url. Also the parameter frmName
which you are taking in function is used nowhere.
Your code can be modified to work properly as follows -
function submitVote(frmName){
$.ajax({
type: "POST",
dataType: 'text',
url: "<?php echo SITEURL; ?>/community/community/add_vote/",
data: "vote="+the_value+"&poll="+poll,
success: function(msg){
//i am assuming that from controller in msg you are sending the total number of votes to that particular entity after ending current vote.
$('#div id where you have displayed your current vote count').html(msg);
}
});
}
精彩评论