12 lines
360 B
JavaScript
12 lines
360 B
JavaScript
|
htmx.defineExtension('json-enc', {
|
||
|
onEvent: function (name, evt) {
|
||
|
if (name === "htmx:configRequest") {
|
||
|
evt.detail.headers['Content-Type'] = "application/json";
|
||
|
}
|
||
|
},
|
||
|
|
||
|
encodeParameters : function(xhr, parameters, elt) {
|
||
|
xhr.overrideMimeType('text/json');
|
||
|
return (JSON.stringify(parameters));
|
||
|
}
|
||
|
});
|