HTML页面后加参数,ajax发送请求

var urlinfo=window.location.search;
      var newdata=urlinfo.split("=");
      var mydata=newdata[1];
      var formdata = new FormData();
      formdata.append("paramId", "PA00100003");
      formdata.append("rdId1", "R1001001");
      formdata.append("dataType", "1");
      formdata.append("timeflagId", "Y");
      formdata.append("parentId", "10604");
      formdata.append("sourceId", "S000001");
      formdata.append("dataDatetime", mydata);

获取路径并截取拼接
ajax请求:

 $.ajax({
          url:"       ",    //请求的url地址
          dataType:"json",   //返回格式为json
          //contentType:"application/x-www-form-urlencoded",
          data:formdata,    //参数值
          type:"post",   //请求方式
          contentType: false,
          //contentType: false,
          processData: false,
          success:function(result){]

你可能感兴趣的:(技术学习)