readconfig.js 760 Bytes
var configtext = null;

function LoadConfig() {
	var path=window.location.origin+"/"+window.location.pathname.split("/")[1]+"/config.txt";
    $.ajax({
        async: false,
        url: path,
        dataType: "json",
        error: function (error) {
        },
        success: function (data) {
            configtext = data;
        }
    });
    return configtext;
}

function GetServiceUrl(iptype,key) {
    var serviceurl = null;
    for (var i = 0; i < configtext["webservices"].length; i++) {
        var item = configtext["webservices"][i];
        if (item["key"] == key) {
            serviceurl = configtext[iptype] + item["url"];
//        	serviceurl=location.href+"/"+item["url"];
            break;
        }
    }
    return serviceurl;
}