开发者

change the html of div tag using jquery ajax in codeigniter [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 y开发者_如何学运维ears ago.

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);
       }
     }); 
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜