首页 > 解决方案 > 我应该如何解决 XMLHttpresponse 的问题

问题描述

我写了一些代码如下:

setInterval(function() {
  var a = new XMLHttpRequest();
  a.open("POST", "third.php", false);
  a.responseType = "";
  var type = a.response;
  a.send(null);
  document.getElementById("response1").innerHTML = a.response;
}, 1000);
<!-- This is HTML div -->
<div id="response2" style="background-color:#6FF;">
</div>

但它返回空值。请问有人说这是什么原因?

标签: javascriptxmlhttprequest

解决方案


推荐阅读