-3
嗨,我是codeigniter的新手。 我想改變我的div標籤使用jQuery的Ajax。在codeigniter中使用jquery ajax更改div標籤的html
嗨,我是codeigniter的新手。 我想改變我的div標籤使用jQuery的Ajax。在codeigniter中使用jquery ajax更改div標籤的html
根據您的評論你當前的代碼似乎是這樣的 -
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);
}
});
}
我想補充的第一件事情就是從你在哪裏得到the_value
和poll值enter code here
?因爲你在代碼中沒有提到這一點。 其次沒有必要在您的網址發送?
。另外你在功能中使用的參數frmName
無處可用。
你可以修改代碼正常工作如下 -
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);
}
});
}
您可以加入只是* *一些更多的細節?就像你想添加的東西,你從哪裏得到它以及你想要它去的地方?注意,jQuery的介紹(例如http://jqfundamentals.com/book/book.html)在這一點上可能對您有用...... – lonesomeday 2011-01-22 10:12:07
ok lonesomeday我想在我的網站上進行投票。我在codeigniter中製作我的控制器,模型和視圖。現在我在我的觀點中得到民意調查。當用戶對該調查投票時,數據也存儲在數據庫中。 afterb,我想改變投票狀態意味着我想添加該投票。 – enthusiastic 2011-01-22 10:55:30