axios.post('http://xxxxxxx/xxxx/login', {
"username": 'xxx',
"password": 'xxx'
})
.then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.log(error);
})
$.ajax({
type: 'POST',
url: 'http://xxx/xxx/login',
dataType: 'json',
data: {
username: 'xxx',
password: 'xxxx'
},
success: function (rs) {
console.log(rs.data);
},
error: function (error) {
console.log(error);
},
async: true,
})
让服务端开启跨域,设置
Access-Control-Allow-Origin
允许你的Origin或者为*。