我正在自定义一个插件,该插件具有包含配置项的数组(如果是这样的话):
var config = {
width: "100%",
height: "100%",
source: 'js/timeline/test.json',
css: 'js/timeline/compiled/css/timeline.css',
js: 'js/timeline/compiled/js/timeline-min.js'
}
我想要做的是获取source:
数据并将其替换为变量,例如:
var mysource = 'path/to/source.json';
var config = {
width: "100%",
height: "100%",
source: mysource ,
css: 'js/timeline/compiled/css/timeline.css',
js: 'js/timeline/compiled/js/timeline-min.js'
}
但由于它上面它不起作用。谁能指出我正确的方向?谢谢
编辑:按要求添加完整代码
$(function() {
$.getJSON('http://www.mysite.com/json.php',
function(data) {
jsonObject = eval(data);
var eventdata = jsonObject.tlall;
});
}); //END ON LOAD
var config = {
width: "100%",
height: "100%",
source: eventdata,
//source: 'js/timeline/test.json',
//start_at_end: true, //OPTIONAL
//hash_bookmark: true, //OPTIONAL
css: 'js/timeline/compiled/css/timeline.css',
js: 'js/timeline/compiled/js/timeline-min.js'
}