【发布时间】:2011-09-20 18:39:43
【问题描述】:
我正在尝试在 php 中创建一个基于电子邮件的应用程序(在 Codeigniter f/w 中)。 我希望能够在单击时将未读消息更改为阅读(我有 2 个类:read0 和 read1)。 我可以立即看到消息的内容,但也想将其更改为“已读”(为 1)。
foreach ($all->result_array() as $row){
print "<tr><td class=read".$row['read']."><a href='#' class='list' name=".$row['au_id'].">".$row['read']."</a></td></tr>";
}
而 ajax 看起来像:
$('.list').click(function() {
$.ajax({
url: "<?php echo site_url('contact/clickMsg'); ?>",
type: 'POST',
data:'app_id='+this.name,
success: function(msg) {
$('#msg_content').html(msg);
}
});
$.ajax({
success: function( smth) {
$('a').html(smth);//Will insert new content inside div element.
}
});
我查看了jQuery reload div's content (dynamically rendered),我想我错过了一些东西。 我也试过 $('a').replace(smth) 但得到相同的输出。
【问题讨论】: