ajax的GET请求和POST请求只有一下几个不同:
xhr.open("POST","file/09-4post.php",true);
xhr.setRequestHeader("content-type","application/x-www-form-urlencoded"); //设置请求头
xhr.send("name=李四&age=34"); //GET是写在open()地址后面的,而POST写在send()里。
GET方法请点击:点击打开链接
ajax的GET请求和POST请求只有一下几个不同:
xhr.open("POST","file/09-4post.php",true);
xhr.setRequestHeader("content-type","application/x-www-form-urlencoded"); //设置请求头
xhr.send("name=李四&age=34"); //GET是写在open()地址后面的,而POST写在send()里。
GET方法请点击:点击打开链接