我有一个 url,它提供了我需要的各种参数。我设法得到了结果,但由于某种原因,它在 IE 中根本没有显示任何结果,我不知道为什么。它适用于所有其他浏览器,但不适用于 IE。我检查了控制台,完全没有错误,我还使用 jslint.com 检查了 js 代码,这也很好。
我已经删除了文件中的所有其他内容,所以它只有这个。
这就是我用来获得结果的方法。我有一个单独的 js 文件,其中包含:
function call(url, parameters, callback) {
"use strict";
$.ajax({
type: 'POST',
url: url,
data: parameters,
success: function(data) {
callback(data);
}
}
);
}
function loadJackpots() {
"use strict";
call("https://www.domain.com/passkey", { JL: 0 },
function(data) {
var divIdentifier, obj = eval('(' + data + ')');
$.each(obj.JL, function() {
divIdentifier = "";
switch (this.gameID) {
case 2:
divIdentifier = "#snap";
break;
case 5:
divIdentifier = "#dominos";
break;
case 1000:
divIdentifier = "#chess1";
break;
case 1001:
divIdentifier = "#chess2";
break;
case 1002:
divIdentifier = "#chess3";
break;
}
if (this.gameID >= 1000) {
switch (this.stakeID) {
case 4:
divIdentifier += "_50c";
break;
case 5:
divIdentifier += "_1d";
break;
case 7:
divIdentifier += "_2d";
break;
case 9:
divIdentifier += "_2d";
break;
}
if (this.gameID === 1000) {
switch (this.subID) {
case 0:
divIdentifier += "_1";
break;
case 1:
divIdentifier += "_2";
break;
case 2:
divIdentifier += "_3";
break;
}
}
$(divIdentifier).html("$" + this.jackpot);
});
}
);
}
我用它来实际加载值:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
loadJackpots();
});
</script>
并显示我正在使用的结果:
<div id="chess1">
<script type="text/javascript">
document.write('<div id="chess1_50c">');
</script>$1466.85</div>
<script type="text/javascript">
document.write('<div id="chess1_1d">');
</script>$1641.11</div>
<script type="text/javascript">
document.write('<div id="chess1_2d">');
</script>$378.04</div>
</div>
<div id="chess3">
<script type="text/javascript">
document.write('<div id="chess3_50c">');
</script>$303.86</div>
<script type="text/javascript">
document.write('<div id="chess3_1d">');
</script>$523.02</div>
<script type="text/javascript">
document.write('<div id="chess3_2d">');
</script>$1473.72</div>
</div>
</div>
<div style="float: left; margin: 194px 0 0 185px;">
<div id="chess2_1">
<script type="text/javascript">
document.write('<div id="chess2_50c_1">');
</script>$195.26</div>
<script type="text/javascript">
document.write('<div id="chess2_1d_1">');
</script>$154.37</div>
<script type="text/javascript">
document.write('<div id="chess2_2d_1">');
</script>$193.76</div>
</div>
<div id="chess2_2">
<script type="text/javascript">
document.write('<div id="chess2_50c_2">');
</script>$146.84</div>
<script type="text/javascript">
document.write('<div id="chess2_1d_2">');
</script>$119.58</div>
<script type="text/javascript">
document.write('<div id="chess2_2d_2">');
</script>$145.86</div>
</div>
<div id="chess2_3">
<script type="text/javascript">
document.write('<div id="chess2_50c_3">');
</script>$2.96</div>
<script type="text/javascript">
document.write('<div id="chess2_1d_3">');
</script>$19.25</div>
<script type="text/javascript">
document.write('<div id="chess2_2d_3">');
</script>$121.89</div>
</div>
</div>
</div>
<div style="height: 80px;">
<div id="snap">
<script type="text/javascript">
document.write('<div id="snap_jp">');
</script>$862.16</div>
</div>
<div id="dominos">
<script type="text/javascript">
document.write('<div id="dominos_jp">');
</script>$2823.18</div>
</div>
我真的很感激任何帮助,因为我已经尝试了一切来对其进行排序,但无论我做什么,它都无法在 IE 中工作
我尝试使用
<script type="text/javascript">
$(document).ready(function() {
alert('test');
}
</script>
看看它是否加载正常,但它根本没有弹出警告框 - 即使我删除了所有内容并且只有警告代码