天天看點

MUI 添加url配置檔案

1.建立一個.json檔案,内容如下

{
	"url":"http:\//'ip':'端口号'\/"
}
           

2.擷取

mui.getJSON('url.json', null, function(rs) { //本地檔案相對路徑,參數為null,回調函數
	console.log(rs.url);
	}
           
mui.getJSON('url.json', null, function(rs) { //本地檔案相對路徑,參數為null,回調函數
	console.log(rs.url);
	mui.ajax({
	url: rs.url + 'LayerParameters/selectAllClassTypeAndLayerParam',
	data: {},
	// async: true,
	dataType: 'json',
	crossDomain: true, //強制使用5+跨域  
	type: 'get',
	// timeout: 10000,
	success: function(data) {
		jointHtml(data);
		mui(".mui-slider").slider();
		},
	error: function(xhr, type, errorThrown) {
		// 請求失敗  
		}
	})
})