方法1:
1.html:
<a href="2.php?id=<{$TJ.result[loop].order_id}>&backurl=<{$backurl}>" οnclick="return confirm('确定要删除该选项吗');">[删除]</a>
2.php:
<?php
$id = intval($_GET['id']);
connect_db('Packsale');
$sql = "delete from order_list where order_id='$id'";
if(mysql_query($sql))
{
$backurl = base64_decode($_GET['backurl']);
$tpl->assign("alert","<script type='text/javascript'>alert('删除成功');location.href='$backurl';</script>");
$tpl->display('success_page.tpl');
exit;
}
else
{
$tpl->assign("alert","<script type='text/javascript'>alert('删除失败');history.back(-1);</script>");
$tpl->display('success_page.tpl');
exit;
}
?>
----------------------------------------------------------------------------
方法2:
function delorder(id)
{
if(confirm('您确定要删除此条购买记录吗'))
{
location.href='http://pt.tuke.com/packsale.php?act=buyview&step=p';
$.post('./ajaxphp/packsale.php',
{order_id:id}
)
alert('删除成功');
}
}
<a href='#' οnclick='delorder(123)'>click here</a>