1.读取xml的配置文件
function getServerPath() {
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET", globals.path + '/component/module/uploadify/js/uploadify.xml', false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
return xmlDoc.getElementsByTagName("server")[0].childNodes[0].nodeValue;
}
<server>http://localhost:8081/lw-fileserver</server>
2.读取json的配置文件
$.getJSON(globals.path + '/component/module/uploadify/js/config.json', function(data){
alert( data.server);
});