ajax call to php with data
ajax call to php with data
esdras2424
Posts: 2Questions: 1Answers: 0
i want to make a ajax call with data within so php functions can return me thru echo a json file, something like this
$('#example').DataTable( {
"ajax":{
"method": "POST",
"url": "../php/todo.php",
},
"data": {
lastUser: lastUser,
tipoSorteo: tipoSorteo,
horarioSorteo: horarioSorteo,
fecha1: fecha1,
fecha2: fecha2,
ejecutar: "ejecutar"
},
"columns": [
{ "data": "tiquete" },
{ "data": "numero" },
{ "data": "monto" },
{ "data": "fecha" },
{ "data": "hora" },
{ "data": "tipo" }
]
} );
Edited to add syntax highlighting
This discussion has been closed.
Answers
Use
ajax.data
to send data to the server.Note that the top level
data
which you are using there should be an array, not an object (it could be an array which contains objects), but is it just is the wrong place? Is that want to what you want to send to the server? Move it into theajax
option.Allan
i´ll try