Q:2493441723

ajax+php+mysql更新

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;
	}
?>

  

posted @ 2014-03-12 15:22  QQ2493441723  阅读(385)  评论(0编辑  收藏  举报