mirror of
https://github.com/zhigang1992/deployd.git
synced 2026-05-24 13:59:27 +08:00
26 lines
500 B
JavaScript
26 lines
500 B
JavaScript
function d(route, data, callback) {
|
|
var arg
|
|
, i = 0
|
|
, options = {
|
|
dataType: 'json',
|
|
contentType: 'application/json'
|
|
}
|
|
;
|
|
|
|
while(arg = arguments[i++]) {
|
|
switch(typeof arg) {
|
|
case 'string':
|
|
options.url = arg;
|
|
break;
|
|
case 'object':
|
|
options.data = JSON.stringify(arg);
|
|
options.type = 'POST';
|
|
break;
|
|
case 'function':
|
|
options.error = options.success = arg;
|
|
break;
|
|
}
|
|
}
|
|
|
|
$.ajax(options);
|
|
} |