目前我正在使用以下方式用 json 获得的数据填充我的全局 js 变量:
var tranlationJson =
$.ajax({
type: "GET",
url: "translation.xml",
contentType: "text/xml",
dataType: "xml",
success: function (dataSource) {
tranlationJson=ToJasonParser(dataSource);
}
});
有没有更聪明的方法?我需要填充这些变量,因为在稍后加载的脚本中我使用它们的内容。