我的删除按钮:
$('#taglist li #delete').bind('click', function(){
pic_id = $(this).parent().attr("rel");
$.post('savetag.php', {"type":"remove", pic_id:pic_id}, function(data){
viewtag();
});
});
保存标签.php
if ($_POST['type'] == "remove")
{
$pic_id = $_POST['pic_id'];
$sql = "DELETE FROM image_tag WHERE `pic_id` = $pic_id";
mysql_query($sql);
}
这是查看标签的脚本 viewtag.php:
$sql = "SELECT * FROM image_tag ORDER BY `pic_id`";
$qry = mysql_query($sql);
$rs = mysql_fetch_array($qry);
if ($rs){
do{
echo '<li rel="'.$rs['pic_id'].'"><a>'.$rs['name'].'</a> <a class = "delete">Delete</a></li>';
}while($rs = mysql_fetch_array($qry));
}
这是允许 viewtag.php 进入我的 index.php 的函数:
viewtag();
function viewtag()
{
$.post('viewtag.php', function(data){
$('#taglist ol').html(data);
});
}
那么问题是什么,为什么不删除表呢?锚标记也不起作用(从 viewtag.php 回显的锚标记)。问题是什么?谢谢。