fetch函数发送ajax请求

fetch函数发送ajax请求

fetch('http://127.0.0.1:8080/fetch-server?vip=10',{
    
    
	//请求方法
	method:'POST',
	//请求头
	headers:{
    
    
		name:'张三'
	},
	//请求体
	body:'username=admin&password=admin'
}).then(response=>{
    
    
	// return response.text();
	return response.json();
}).then(response=>{
    
    
	console.log(response);
})

猜你喜欢

转载自blog.csdn.net/m0_48546501/article/details/130660666