INVALID_STATE_ERR: DOM Exception 11

后端 未结 4 1857
隐瞒了意图╮
隐瞒了意图╮ 2021-02-05 11:14

I\'m developing a simple auxiliary class to send requests using XmlHttpRequest (code below). But I cant make it work. At google chrome, for example, I get the error INVALI

4条回答
  •  情深已故
    2021-02-05 11:37

    Usually this error occurs with the XMLHttpRequest when you call the open method with async = true, or you leave the async parameter undefined so it defaults to asynchronous, and then you access the status or responseText properties. Those properties are only available after you do a synchronous call, or on the readyState becoming ready (once the asynchronous call responds). I suggest you first try with async = false, and then switch to it being true and use the onReadyStateChange.

提交回复
热议问题