html代码
<input type="button" id="quxiao" class="quxiao" name="quxiao" value="取消"> <input type="hidden" id="oid" name="oid" value="<?php echo $v[‘oid‘];?>"
js代码
<script type="text/javascript"> $(document).ready(function(){ $(".quxiao").each(function(){ $(this).click(function(){ quxiao($(this)); }) }) }); function quxiao(obj){ var oid = $("#oid").val(); $.ajax({ type:"post", url:"xgkcg.php", dataType:‘json‘, success:function(){ alert("成功取消订单!"); location.href=window.location.href; } }) } </script>
xgkcg.php代码
<?php require_once("config.php"); header(‘content-type:application/json‘); $oid=$_POST[‘oid‘]; //$oid=addcslashes($_POST[‘oid‘]); $sql="delete from `djs_shops_orders` where oid = ‘$oid‘"; $result = mysql_query($sql); if($result){ return true; }else{ return false; } ?>