1创建ajax对象
var xhr=new XMLHttpRequest()
2配置请求
xhr.open('post','./post.php')
3发送请求
xhr.send('c=100&d=200')//携带了参数c和d
3接收响应
xhr.onload=function(){
console.log(xhr.responseText)
}
//设置请求头
xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded')
简易发送一个带有参数的post请求
最新推荐文章于 2023-09-25 16:09:00 发布