saasService.js 1.64 KB
var saas = {
    url: "http://saasapi.dituhui.com",
    // url: "http://114.55.43.0:16907",
    // customUrl:"http://120.55.114.153:16900",
    customUrl:"http://localhost:16900",
    ak:"ee824a89bb2b4c7cb74399bf9d5165bc",
    // ak:"30bdc45ee00940cda7917d134fdb1523",
    saasHttpRequest: function (method, parameter, successComplate, errorComplate) {
        if(parameter){
            parameter.ak = saas.ak;
        }else{
            parameter = {ak:saas.ak};
        }
        var config = {
            url:saas.url + method,
            data:parameter,
            dataType:"jsonp",
            type: "POST",
            timeout: 90000,
            success: successComplate,
            error: errorComplate,
        };
        $.ajax(config);
    },
    customHttpRequest: function (method, parameter, successComplate, errorComplate) {
        if(parameter){
            parameter.ak = saas.ak;
        }else{
            parameter = {ak:saas.ak};
        }
        var config = {
            url:saas.customUrl + method,
            data:parameter,
            dataType:"json",
            type: "POST",
            timeout: 90000,
            success: successComplate,
            error: errorComplate,
        };
        $.ajax(config);
    },
    upLoadHttpRequest: function (method, formData, successComplate, errorComplate) {
        var config = {
            url:saas.url + method,
            type: "post",
            data: formData,
            contentType: false,
            processData: false,
            mimeType: "multipart/form-data",
            success: successComplate,
            error: errorComplate,
        };
        $.ajax(config);
    }
}