读取json文件
$.ajax({ url: 'manifest.webapp', type: 'GET', dataType: 'json',//类型不对会出错 timeout: 1000, //设定超时 cache: false, //禁用缓存 error: function() { alert("加载webapp文档出错!"); }, success: function(e){ sessionStorage.KeepLinkTime=e.KeepLinkTime LoginOutByTimer(); //zhdMapServerUrl=$(e).find("serverurl").text(); },//设置成功后回调函数 async: false// 同步或者异步请求(true:异步,false:同步) });
读取xml文件
$.ajax({ url: 'config.xml', type: 'GET', dataType: 'xml', timeout: 1000, //设定超时 cache: false, //禁用缓存 error: function(xml) { alert("加载全景配置XML文档出错!"); }, success: function(xml){ zhdMapServerUrl=$(xml).find("serverurl").text(); },//设置成功后回调函数 async: false// 同步或者异步请求(true:异步,false:同步) });