0

i have jquery datatable i need to pass 2 arguments with this code does not works perhaps does not call the procedure

    var params = {
        "name": "ProgressivoRichiesta", "value": $("input[name='<%=txtTargaResponsabile.UniqueID%>']").val(),
        "name": "sDataIncidente", "value": $("input[name='<%=txtDataSinistro.UniqueID%>']").val()
    }

   $('#listReceivedMail').DataTable({
            destroy: true,
            "dataType": 'json',
            "contentType": "application/json; charset=utf-8",
            "type": "GET",
            "url": "CinfoService.svc/ProcedureName",
            "data": params,

thanks

0

1 Answer 1

1

To pass the parameters the way you're currently doing it requires this change:

var model = { ProgressivoRichiesta: $("input[name='<%=txtTargaResponsabile.UniqueID%>']").val(),
              sDataIncidente: $("input[name='<%=txtDataSinistro.UniqueID%>']").val()
};

$('#listReceivedMail').DataTable({
            destroy: true,
            "dataType": 'json',
            "contentType": "application/json; charset=utf-8",
            "type": "GET",
            "url": "CinfoService.svc/ProcedureName",
            "data": JSON.stringify(model),

But to pass them using the API, you need to do this:

$('#listReceivedMail').DataTable({
        "ajax": {
                 "url": "CinfoService.svc/ProcedureName",
                 "data": function ( d ) {
                     return $.extend( {}, d, {
                        ProgressivoRichiesta: $("input[name='<%=txtTargaResponsabile.UniqueID%>']").val(),
                        sDataIncidente: $("input[name='<%=txtDataSinistro.UniqueID%>']").val()
                     });
                 }
            },
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.