码迷,mamicode.com
首页 > Web开发 > 详细

jquery实现get的异步请求

时间:2019-06-10 13:35:02      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:cti   sub   log   回调函数   www   pre   mil   func   请求   

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>ajax</title>
<script src="/ajax/js/jquery-3.3.1.min.js"></script>
</head>
<body>
<form action="http://www.ubfgho.com/" method="post" enctype="application/x-www-form-urlencoded">
姓名:<input type="text" name="name"><span></span><br>
密码:<input type="password" name="psw"><br>
<input type="submit" value="提交"><br>
</form>
</body>
<script>
//jquery实现get的异步请求
/*
* 1url
* 2、发送给服务器的参数
* 3、回调函数--接受响应正文
* 4、期望服务器响应的数据格式
* */
$(‘:text‘).blur(function () {
var name1=$(this).val().trim()
$.get("/ajax/login?",{"name":name1},function (d) {
$("span").html(d).css("color","red");
},"text");
})

jquery实现get的异步请求

标签:cti   sub   log   回调函数   www   pre   mil   func   请求   

原文地址:https://www.cnblogs.com/xiaoshenke/p/10997061.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!