67 lines
1.4 KiB
JavaScript
67 lines
1.4 KiB
JavaScript
function myPost(url, data, callback) {
|
|
var settings = {
|
|
"url": url,
|
|
"method": "POST",
|
|
"headers": {
|
|
//"Content-Type": "application/json"
|
|
//"target":"http://exhall.dev.yiyiny.com"
|
|
},
|
|
"crossDomain": true,
|
|
// "processData": false,
|
|
// "contentType": false
|
|
"data": JSON.stringify(data),
|
|
};
|
|
|
|
if (data != undefined && data != null) {
|
|
settings.data = data;
|
|
}
|
|
|
|
$.ajax(settings).done(function (response) {
|
|
//console.log('http:', response);
|
|
if (undefined != callback) {
|
|
callback(response)
|
|
}
|
|
});
|
|
}
|
|
|
|
function filePost(url, sign, data, callback, isFormData) {
|
|
var settings = {
|
|
"url": url,
|
|
"method": "POST",
|
|
"headers": {
|
|
"Authorization": sign,
|
|
//"Host":"https://tookuu-1301626238.cos.ap-nanjing.myqcloud.com"
|
|
},
|
|
"crossDomain": true,
|
|
"processData": false,
|
|
"timeout": 3000000,
|
|
"contentType": false
|
|
};
|
|
|
|
if (data != undefined && data != null) {
|
|
if (isFormData == true) {
|
|
settings.data = data;
|
|
} else {
|
|
settings.data = JSON.stringify(data);
|
|
}
|
|
}
|
|
|
|
$.ajax(settings).done(function (response) {
|
|
if (undefined != callback) {
|
|
callback(response)
|
|
}
|
|
});
|
|
}
|
|
|
|
//取URL参数
|
|
function getQuery(variable) {
|
|
var query = window.location.search.substring(1);
|
|
var vars = query.split("&");
|
|
for (var i = 0; i < vars.length; i++) {
|
|
var pair = vars[i].split("=");
|
|
if (pair[0] == variable) {
|
|
return pair[1];
|
|
}
|
|
}
|
|
return (false);
|
|
} |