zoukankan      html  css  js  c++  java
  • XMLHttpRequest发送请求

    *open(method,url,async)

    *send(string)//在使用get请求的时候,是没有主体的,所有的信息都会拼在url当中,所以使用send的时候括号里的string可以为空!如果是使用post请求,这个send就一定要填写参数,不然就没有什么意义。
     
    request.open("get","get.php",true);//get请求
    request.send();//在发送出去
     
    request.open("post","post.php",true);//post请求
    request.send();//无参数,无意义。
     
    request.open("post","create.php",true);//post请求
    request.setRequestHeader("Content-type","application/x-www-form-urlencoded");//设置http的头信息,告诉服务器我们要发送一个表单。
    request.send("name=王二狗&sex=男");//发送请求的响应体。
  • 相关阅读:
    设计模式学习笔记一
    linux学习记录(一)
    eclipse插件集合
    什么叫反向代理?
    shiro学习四
    shiro学习三
    shiro学习二
    第二次作业
    第一次作业
    自我介绍
  • 原文地址:https://www.cnblogs.com/Yirannnnnn/p/4846385.html
Copyright © 2011-2022 走看看