我的js函数使用变量“ categorylink ”来制作一些超链接并且效果很好
$(function () {
var chart1;
var categoryLinks = {
'Career prospects':'http://localhost/Landa/DirectManagers/501-NitzanHarLavan/Dim01.html',
'Compensation':'http://localhost/Landa/DirectManagers/501-NitzanHarLavan/Dim02.html',
};
$.get('graphdata/DIMAVGOTHERSforMgrs.txt?x='+microtime(), function(json){
obj = eval('({'+json+'})');
var $container = $('#container');
$(document).ready(function() {
chart = new Highcharts.Chart(obj)
});
});
});`
我希望从文本文件中导入 var categoryLinks = {.....}; 部分代码。我用过
var client = new XMLHttpRequest();
client.open('GET', 'foo.txt');
client.onreadystatechange = function() {
alert(client.responseText);
}
client.send();
foo.txt包含 var categoryLinks = {.....}; 部分代码,但不起作用
请帮忙