js发送http请求

function post_request(url, param){
	console.log("执行post请求" + url)
	const Http = new XMLHttpRequest()
	Http.open("POST", url)
	Http.setRequestHeader("Content-type","application/json")
	var info = param
	Http.send(info)
	Http.onreadystatechange = function(){
		if(Http.readyState == 4 && Http.status == 200){
			var json = Http.responseText
			console.log(json)
		}
	}
}

你可能感兴趣的:(javascript,http,开发语言)