I need to send an object that contains a variable in js, the idea is to be able to send that information to python (I use django) and capture that info to be able to perform the validations that I need from the backend (python) and not from js, how can I do it ?
code ajax:
function CapturarDatosOrden() {
$.ajax({
url: window.location.pathname,
type: 'POST',
data: {
'action': 'prueba',
},
beforeSend: function (jqXHR) {
$.xhrPool.push(jqXHR);
$(".loader").fadeIn('fast');
},
dataType: 'json',
complete: function (jqXHR) {
// boton.disabled = false;
$('.loader').fadeOut('fast');
var index = $.xhrPool.indexOf(jqXHR);
if (index > -1) {
$.xhrPool.splice(index, 1);
}
},
}).done(function (data) {
// alert('entro al primer ajax para comparar el tipo de orden y su tecnologia')
var info = data.find(data => data.id__ordenes == idOrden);
the "info" variable has the object I need to capture in python, the object is something like this:
{ id__ordenes: "219661981", fk_ot__tipo_orden: "4", fk_bss__contratos: "3257733", otciudad: "1", otdireccion: "----", fk_ot__cc: "1", open_orden: "42588165", instalador: "4320", fk_contratistas__equipos_vendedores: "1", fk_ot__causales: "88" }
how can i do it?