0
真的可以使用一些帮助/逻辑。即兴 - 简单传递变量到URL
我想通过一个jQuery的即兴可以被用来追加到一个目标网址的href elementid。
即,先从A HREF:
<a class="link" href="javascript:;" elementid="66">Remove item</a>
我希望它这样,如果我点击这个链接就会送我去:去除-element.php elementid = 66
我的JavaScript看起来像:
<script>
function removeItem(id) {
var txt = 'Are you sure you want to remove this item?';
$.prompt(txt, {
buttons: {Yes: true, Cancel: false},
callback: function(accept) {
if (accept) {
window.location = "remove-element.php?elementid=x";
}
return false;
}
});
}
$('a.link').click(function() {
removeItem($(this).data('id'));
return false;
});
</script>
谢谢你一吨。真的很感谢帮助。干杯。保罗 – Brandrally 2014-11-03 07:50:27