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

  

ajax+php+mysql更新,布布扣,bubuko.com

ajax+php+mysql更新

上一篇:Oracle取得中文拼音首字母函数


下一篇:详解MySQL Cluster管理结点的config.ini配置文件