Patch exec_json() and related functions to support file uploads

This commit is contained in:
Kijin Sung 2024-10-08 23:25:03 +09:00
parent 0a625662f7
commit d45c116c56
2 changed files with 35 additions and 6 deletions

View file

@ -215,7 +215,12 @@
var action_parts = action.split('.');
var request_info;
if (action === 'raw') {
request_info = 'RAW FORM SUBMISSION';
if (params instanceof FormData) {
request_info = params.get('module') + '.' + params.get('act');
} else {
request_info = 'RAW FORM SUBMISSION';
}
console.log(request_info);
} else {
params = params ? ($.isArray(params) ? arr2obj(params) : params) : {};
//if (action_parts.length != 2) return;
@ -342,7 +347,7 @@
// Send the AJAX request.
try {
$.ajax({
var args = {
type: "POST",
dataType: "json",
url: url,
@ -351,7 +356,11 @@
headers : headers,
success : successHandler,
error : errorHandler
});
};
if (params instanceof FormData) {
args.contentType = false;
}
$.ajax(args);
} catch(e) {
alert(e);
return;