<pre name="code" class="javascript"><pre name="code" class="html"><span style="font-family: 'Microsoft YaHei';"><script type="text/javascript"> </span>
var id;
$(document).ready(function() {
$("a").click(function(){
$id = $(this).attr('id');
$.get("__URL__/fun?id="+$id,function(data,status){
if (data == -1)
{
if (confirm("請確認"))
{
$.get("__URL__/contribute?id="+$id,function(data,status){
$("#div"+$id).html("成功");
});
}
}
else if (data == 1)
{
alert("成功");
}
else if (data == 0)
{
if (confirm("請確認"))
{
$.get("__URL__/docontribute?id="+$id,function(data,status){
$("#div"+$id).html("成功");
alert("成功");
});
}
}
});
});
});
</script>
</pre><pre name="code" class="javascript"><!--存放數據的容器-->
<div id=<?php echo 'div'.$vo['id']; ?> >
</div>
<!--觸發jq事件-->
<a href="javascript:void;" id={$vo['id']} >確認</a>