html代碼: <html>
<head>
<script src="jquery-1.3.2.js"></script>
<script>
$(function(){
$("#helloBtn").click(function(){
$.ajax({
url: "test.php",
type: "POST",
success: function(res){
alert(res);
},
error: function(msg){
alert('error');
}
});
});
});
</script>
</head>
<body>
<button id="helloBtn">hello</button>
</body>
</html>php代碼: <?php
echo 'hello';
?>結(jié)果:我用的是apache服務(wù)器。
使用ajax和php,ajax的返回結(jié)果為什么一直是php代碼?
喵喵時(shí)光機(jī)
2018-10-25 18:18:20