Bootstrap

ajax-get和post传参(超详细)

GET传参

在这里插入图片描述

<script>
var xml = new XMLHttpRequest();
xml.onreadystatechange = function(){
	if(xml.readyState == 200){
		if(xml.status == 4){
			console.log('success');
		}
	}
}
xml.open('GET','http://jsonplaceholder.typicode.com/posts/1',true);
xml.send();
</script>

POST传参

在这里插入图片描述

<script>
var xml = new XMLHttpRequest();
xml.onreadystatechange = function(){
	if(xml.readyState == 200){
		if(xml.status == 4){
			console.log('success');
		}
	}
}
xml.open('POST','http://jsonplaceholder.typicode.com/posts/1',true);
xml
;