get和post的区别

1、get请求将参数放在请求地址url的后面

2、post请求时将参数放在http请求空白行的后面

3、get请求时参数大小有限制

4、post请求理论上对参数大小无限制

5、post比get安全一些

post请求时请求头多个Content-type,值是 application/x-www-form-urlencoded

ajax发送请求其实就是模拟http请求

所以ajax对象的post请求也要加上content-type的请求头

  xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

content的内容格式和http请求空白行后面的格式要一致

first=545&s=55 这种格式

js中字符串分割

                var str=xhr.responseText;
                var result=str.split(',');
                document.getElementById('sp').innerHTML=result[0]+'<br/>';
                document.getElementById('sp').innerHTML+=result[1]+'<br/>';
                document.getElementById('sp').innerHTML+=result[2]+'<br/>';
                document.getElementById('sp').innerHTML+=result[3]+'<br/>';
原文地址:https://www.cnblogs.com/hhfhmf/p/4798991.html