【发布时间】:2019-04-24 19:12:07
【问题描述】:
调用“删除”链接的正确方法?
使用 jquery,当我单击“删除”链接时,我怎样才能调用该函数?
在引导模式中
我的 HTML:
<table>
<tr>
<td valign="">
<div id="imgtag">
<center><div id="uploads3"><?php echo $eq_picPa; ?></div></center>
<div id="tagbox">
</div>
</div>
</td>
<td valign="top">
<div id="taglist">
<span class="tagtitle">List of Tags</span>
<ol>
<li rel="1"><a>jelly</a> (<a class="remove">Remove</a>)</li>
</ol>
</div>
</td>
</tr>
</table>
我的 JS:
$('#taglist').on('click', 'li a.remove',function(){
alert('hi');
id = $(this).parent().attr("rel");
type = "remove";
// get all tag on page load
$.ajax({
type: "POST",
url: "savetag.php",
data: {"id": id, "type": type},
success: function(data){
viewtag();
}
});
});
【问题讨论】:
-
请有人帮帮我!
-
您得到的响应/错误是什么?
-
什么都没有。没有触发
-
我的点击功能对吗?
-
你试过我的答案了吗?