xml http请求在Opera mini中不起作用

时间:2019-08-23 04:59:28

标签: javascript xmlhttprequest opera-mini

var xhttp = new XMLHttpRequest();

xhttp.onreadystatechange = function () {
    alert(this.status) // this alert showing 0
    if (this.readyState == 4 && this.status == 200) {
        console.log("data==", this.responseText)
        //document.getElementById("demo").innerHTML = this.responseText;
    }
};
xhttp.open("POST", "url", true);
xhttp.setRequestHeader('Content-type', 'application/json');
xhttp.send(JSON.stringify({"name":"myname" }));

以上是我的代码,该代码在桌面Opera和所有其他浏览器上都可以正常运行,但在Opera mini中则无法运行,状态为0,请有人帮我解决。

0 个答案:

没有答案