Files
2024_WEBSITE_fipf/plugins/fipfcard_plugin/utils/plugin_ajax.js
asus 04c4ea31d5 - moving ajax script outside plugin class, as a js file
- wip trying to use the wordpress image editor
2024-02-19 00:46:03 +01:00

20 lines
522 B
JavaScript

/**
* function that create an ajax post action
* - PLGNTLS_data.ajax_nonce and PLGNTLS_data.ajax_url
* are passed from the class PLGNTLS_class
*/
console.log("PLGNTLS_data");
console.log(PLGNTLS_data);
function PLGNTLS_ajax(data_key, data_value, action) {
const data = new FormData();
data.append("action", action);
data.append("_ajax_nonce", PLGNTLS_data.ajax_nonce);
data.append(data_key, data_value);
return fetch(PLGNTLS_data.ajax_url, {
method: "POST",
credentials: "same-origin",
body: data
});
}