記錄一個ajax的一個測試程序
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<% #include virtual="/include/page.html"%>
</head>
<body>
<button class="btn">按鈕</button>
<script>
$(".btn").click(function(){
console.log("ajax func");
$.ajax({
url: 'status.asp',
async:true,
dataType: 'json',
type: 'post',
data:{"StatusType":"2"},
success: function(data) {
console.log(data);
console.log("2");
},
error: function(xhr, type, errorThrown) {
console.log("加載失敗2");
}
});
});
</script>
</body>
</html>