Improved Fetch API AJAX post helper
Now allows to send unconverted data.
This commit is contained in:
parent
959393803c
commit
b4ef58c9f0
2
js/utility.min.js
vendored
2
js/utility.min.js
vendored
File diff suppressed because one or more lines are too long
@ -56,7 +56,7 @@ const _$$$ = document.getElementById.bind(document);
|
||||
* or rejects with the response object on failure.
|
||||
*/
|
||||
|
||||
async function fcn_ajaxPost(data = {}, url = null, headers = {}) {
|
||||
async function fcn_ajaxPost(data = {}, url = null, headers = {}, convert = true) {
|
||||
// Get URL if not provided
|
||||
if (!url) url = fictioneer_ajax.ajax_url;
|
||||
|
||||
@ -78,7 +78,7 @@ async function fcn_ajaxPost(data = {}, url = null, headers = {}) {
|
||||
credentials: 'same-origin',
|
||||
headers: final_headers,
|
||||
mode: 'same-origin',
|
||||
body: new URLSearchParams(data)
|
||||
body: convert ? new URLSearchParams(data) : data
|
||||
});
|
||||
|
||||
// Return response
|
||||
|
Loading…
x
Reference in New Issue
Block a user