The function usnmvalia () {let params={}; Params. Username=$(" # usnm "). Val (); Let data=https://bbs.csdn.net/topics/JSON.stringify (params); $. Ajax ({url: "login", type: "post", data: data, contentType: 'application/json; Charset=utf-8 'success: function (data) {if (data. The toString ()=="ok") {$(' # usnmvali). CSS (" color ", "green"); } else {$(' # usnmvali). CSS (" color ", "red"); } $(" # usnmvali "). The HTML (data); }})} & lt; P> User name: & lt; Input type="text" id="usnm onblur"="usnmvalia ()"/& gt;