$.ajax
时间:2016-12-30 15:41:17
收藏:0
阅读:198
<input class="du_click" type="button" value="按钮" />
<?php
$du = array(‘name‘=>$_POST[‘du‘]);
echo json_encode($du);
?>
<script type="text/javascript">
$(function(){
$(".du_click").click(function(){
$.ajax({
type:"POST",
url:"http://localhost/muke/Index/user",
async:true,
data: {du:‘付秋霞‘},
dataType: "json",
success:function(date){
alert(date.name);
},
error:function(){
alert(2);
}
});
})
})
</script>
原文:http://www.cnblogs.com/duguangyan/p/6236991.html
评论(0)