GET:一般用于信息的获取 使用URL传递参数 对所发信息的数量也有限制,一般在2000个字符; POST:一般用于修改服务器上的资源,对所发信息的数量无限制
XMLHttpRequest发送请求方法: 1.open(method(post/get),url,async(同步还是异步,异步是true,同步是false,大多数异步。异步true可省略。) 2.send(string)request.open("POST","create.php",true) request.setRequestHeader("Content-type","pplication/x-www-form-urlencoded") request.send("name=二狗&sex=男");取得响应request.onreadystatechange = function(){ if(request.readyState===4&&request.status===200){ //做一些事情 如 request.reponse Text } }
ajax (mooc)
最新推荐文章于 2025-02-13 00:00:31 发布
