为什么我应该删除临时互联网文件(ie9),只有这样我才能加载数据
why I should delete the temporary internet files (in ie9) and only then I can load data
我有一个非常奇怪的问题-当你点击一个按钮,我做一个ajax调用轴web服务,从PostgreSQL数据库获取数据,并填写一些输入。
然而,在我用数据填充输入后,当我再次单击按钮时,什么也没有发生,我没有得到任何错误。只有当我删除ie9中的临时internet文件时,我才能在我的输入中加载新的数据。
这是当你点击一个按钮时执行的函数:
function fetchCompanyInfo() {
var xmlhttp = createXMLHttpRequest();
var request = "http://localhost:9090/verifydatabase/services/verifydatabase/getData";
xmlhttp.open("GET", request, true);
handleStateChangeFetchInfo(xmlhttp);
xmlhttp.send();
}
function handleStateChangeFetchInfo(xmlhttp) {
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var xmlObj = xmlhttp.responseXML;
var textXML = xmlObj.documentElement.firstChild.firstChild.nodeValue;
if (window.DOMParser) {
parser = new DOMParser();
var xmlDoc = parser.parseFromString(textXML, "text/xml");
} else {
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.loadXML(textXML);
}
var rows = xmlDoc.getElementsByTagName("row");
for (var i = 0; i < rows.length; i++) {
mycurrent_row = document.createElement("tr");
var cols = rows[i].getElementsByTagName("colunm");
for (var j = 0; j < cols.length; j++) {
if (cols[j].getAttribute("colname") == "biz_subject") {
document.getElementById("old_biz_subject").value = cols[j].getAttribute("colvalue");
document.getElementById("txbbiz_subject").value = cols[j].getAttribute("colvalue");
} else
if (cols[j].getAttribute("colname") == "company_type") {
document.getElementById("old_company_type").value = cols[j].getAttribute("colvalue");
document.getElementById("txbcompany_type").value = cols[j].getAttribute("colvalue");
} else
if (cols[j].getAttribute("colname") == "country") {
document.getElementById("old_country").value = cols[j].getAttribute("colvalue");
document.getElementById("txbcountry").value = "Р България";
} else
if (cols[j].getAttribute("colname") == "nace_code") {
document.getElementById("old_nace_code").value = cols[j].getAttribute("colvalue");
document.getElementById("txbnacecode").value = cols[j].getAttribute("colvalue");
}
}
}
pinCompanyLocation(document.getElementById("old_location").value);
}
}
}
您的AJAX是否可能被缓存?尝试在URL中添加时间戳:
xmlhttp.open("GET", request + "?timestamp=" + (+new Date), true);
很难理解您想要做什么,但是从您的描述中,听起来像是您试图在某人单击按钮时从远程服务更新某些文本框中的值。不过,看起来脚本实际上也在创建文本框。我怀疑当有人第二次单击您的按钮时,它无法创建字段,因为它们已经存在于DOM中。我假设它工作后,你的"清除缓存",因为你可能重新加载页面了。
相关文章:
- 将HTML表格导出到excel时,无法将数据加载到excel文件中
- 如何将本地json数据加载到Extjs数据模型中
- FancyTree JS+Backbone.JS-将数据加载到FancyTree时出现问题
- 将数据加载到使用JSON返回的表单字段时出现问题
- 将基本CSV数据加载到D3
- 如何将JSON数据加载到Jqgrid中
- 点击事件时将新的JSON数据加载到Angular中
- 如何使用输入数据加载新的extjs图表
- 读取外部local.txt文件以将数据加载到数组中
- 将数据加载到地图上的更好解决方案
- 将谷歌地理编码(从url)数据加载到javascript变量中
- 按钮在第一次成功的 ajax 数据加载后不起作用
- Jquery 工具提示未随 AJAX 数据加载一起显示
- 将 json 数据加载到 CycleJS 应用程序中
- 将图像数据加载到Angularjs中
- 页面加载前的Angular JS数据加载
- 将数据加载到存储后,Extjs组合框为空
- 将从服务器获取的数据加载到输入文本表单中
- 从 txt 加载数组,将数据加载到 html 中
- 如何将PostgreSQL数据加载到HTML/JS中