saasService.js
1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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);
}
}