javascript - 我应该如何解决 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>
但它返回空值。请问有人说这是什么原因?
解决方案
推荐阅读
- javascript - 有没有办法在默认服务器位置(Javascript 或 jQuery)上获取索引 HTML 文件名
- javascript - 条件解构数组
- sql-server - SSRS - 使用报表分页时如何将数据导出到单个 Excel 电子表格?
- java - 如何在 UDAF 中使用第三方不可序列化对象?
- mysql - 将表上传到服务器时出错
- java - Gradle 包含已编译的 Java 类作为模块依赖项
- odata - 计算 Dynamics CRM Online web api (ODATA) 中的所有行
- r - 使用 R 将数据框转换为表格?
- usb - 为什么 Adafruit CircuitPython 板的文件系统可能无法挂载?
- d3.js - d3.js 行未显示过滤后嵌套数据的一部分