1 问题
使用JQuery如何发送get请求?
2 解决方法
代码实现:点击button,获取input中的内容,发送get请求
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="../css/index.css" />
<script src="../js/jquery.min.js"></script>
<script>
$(document).ready(function () {
$(".mid span button").click(function () {
param = $(".mid span input").val()
$.ajax({
url: "",
method:"GET",
data:{url:param},
success:function (data) {
console.log(data);
}
});
});
});
</script>
</head>
<body>
</body>
</html>