标签:stat get请求 ext element encode response pen name nload
window.onload = function(){
document.getElementById(‘username‘).onblur = function(){
var name = document.getElementById(‘username‘).value;
name = encodeURIComponent(name); // 编码
var request = new XmlHttpRequest();
request.open(‘get‘, ‘demo.php?name=‘+name);
request.onreadystatechange = function(){
if (request.readystate == 4 && request.status == 200) {
var str = request.responseText();
alert(str);
}
}
}
}
标签:stat get请求 ext element encode response pen name nload
原文地址:https://www.cnblogs.com/wangshengl9263/p/9029645.html