【Ajax】jQuery调用Ajax

<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>

<style type="text/css">

</style>

<script src="jquery.js"></script>
<script>
$(function(){ 
  $("#button1").click(function(){ 
			$.ajax({

        url : 'test.php',

        type : "GET",	//xhr.open();

        data : "username=kjh", //xhr.send();

        async : false,	//是否异步

        success : function(data) {
			alert(data);
            

        }

    });    





  }); 
}); 


</script>

	





<body>
	<div id="div1">
	<input type="button" id="button1" value="提交">
	</div>
</body>


</html>

test.php

<?php
echo $_GET[username];



发布了171 篇原创文章 · 获赞 29 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/weixin_43560272/article/details/103031788