Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state mus
Posted 黑黑哈哈
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state mus相关的知识,希望对你有一定的参考价值。
在设置请求头的时候报这个Failed to execute ‘setRequestHeader‘ on ‘XMLHttpRequest‘: The object‘s state must be OPENED.,是由于需要先打开XMLHttpRequest
var xhr = new XMLHttpRequest(); //打开xhr xhr.open(‘GET‘,url ); //设置请求头,请求头的设置必须在xhr打开之后,并且在send之前 xhr.setRequestHeader(‘user-sessionid‘, sessionId);
以上是关于Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state mus的主要内容,如果未能解决你的问题,请参考以下文章
Error: failed to execute 'C:KeilARMARMCC'的解决办法
Error: failed to execute 'C:KeilARMARMCC'的解决办法
DOMException: Failed to execute 'insertBefore' on 'Node'
vue 项目报错:Error in nextTick: "InvalidCharacterError: Failed to execute 'setAttribute' on
React Native错误集Import fails with "Failed to execute 'ImportScripts' on 'WorkerGlo
fetch 报错 Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot