var xhr = new XMLHttpRequest();
xhr.timeout = 30000; //设置超时
xhr.open("post", '/yxcAdmin/symptom/add/excel', true);
let token = sessionStorage.getItem('token')
xhr.setRequestHeader('token', token);
xhr.responseType = "json";
xhr.onload = function () {
if (xhr.response.status != 0) {
that.$message.error(xhr.response.message)
return false;
}
that.$message.success('上传文件成功!')
};
xhr.ontimeout = function () {
that.$message.error('数据加载失败,请刷新页面')
};
xhr.onerror = function (res) {
that.$message.error('数据加载失败,请刷新页面')
};
xhr.send(form);
发送原生ajax
最新推荐文章于 2023-05-25 11:29:02 发布