标签:实测 stat head ica oct cte XML 多次 file
AJAX传输
例:const xhr = new XMLHttpRequest();
// 此方法因为状态改变被调用多次,实测执行三次(1->2->4)
xhr.onreadystatechange = () => {
if (xhr.readystate === 4 && xhr.status === 200) {
console.log(‘upload success’);
} else {
console.log(‘upload fail);
}
};
xhr.open(‘PUT’, ’网址’);
xhr.setRequestHeader(‘content-type’, ‘application/octet-stream’);
xhr.send(图片文件file);
标签:实测 stat head ica oct cte XML 多次 file
原文地址:https://www.cnblogs.com/dlm17/p/12345389.html