Help aodata.push with the new datatable 1.10
Help aodata.push with the new datatable 1.10
lucianocortes
Posts: 7Questions: 1Answers: 0
Hi, Please I need someone explain me how it works the new version of datatable with aodata.push. I tried everything but nothing works... please some help
'sAjaxSource': "Principal.aspx/ObtenerRegistros",
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "name": "stRefrescarBoset", "value": $("#stRefrescarBoset").val() });
aoData.push({ "name": "LISTA_CAMPOS_BUSQUEDA", "value": $("#LISTA_CAMPOS_BUSQUEDA").val() });
aoData.push({ "name": "LISTA_VALORES_BUSQUEDA", "value": $("#LISTA_VALORES_BUSQUEDA").val() });
aoData.push({ "name": "LISTA_OPERADORES", "value": $("#LISTA_OPERADORES").val() });
aoData.push({ "name": "LISTA_TIPO_DATOS", "value": $("#LISTA_TIPO_DATOS").val() });
aoData.push({ "name": "LISTA_CAMPOS_SELECT", "value": $("#LISTA_CAMPOS_SELECT").val() });
aoData.push({ "name": "LISTA_CAMPOS_FORMATOS", "value": $("#LISTA_CAMPOS_FORMATOS").val() });
aoData.push({ "name": "LISTA_CAMPOS_LARGOS", "value": $("#LISTA_CAMPOS_LARGOS").val() });
aoData.push({ "name": "LISTA_CAMPOS_ALINEACION", "value": $("#LISTA_CAMPOS_ALINEACION").val() });
aoData.push({ "name": "iLinkColum", "value": $("#iLinkColum").val() });
aoData.push({ "name": "bOnlySelectedIds", "value": $("#chkOnlySelectedIds").is(':checked') });
aoData.push({ "name": "stPreFilter", "value": $("#stPreFilter").val() });
$.ajax({
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"type": "POST",
"url": sSource,
"data": aoData,
"async": true,
"success": function (responseJson) {
var response = JSON.parse(responseJson["d"]);
}
});
}
Any advice... some i have to look... please... some exaple!
Thanks
This question has accepted answers - jump to:
This discussion has been closed.
Answers
I made this but it doesn't work
The fnServerData method is legacy. If you want to add data to be sent to the server use
ajax.data
- example here.Allan
Hi allan!
I use the exaple but it doesn't work... i'm usin a webmethod with this code:
The error said that I need a Constructor... I don't understand
Is your
data
function inside theajax
object like in the example?Are you saying that the page I linked to doesn't work for you? It does for me.
Allan
The Page it works... the example it doesn't.
Thanks anyway
Hello,
try something like:
Thanks jaclerigo! it works!
@lucianocortes great. Glad to have helped.