Datatable ajax call

Datatable ajax call

saivathsowsaivathsow Posts: 1Questions: 0Answers: 0
edited September 2018 in Free community support

Hi,

I want to send the data(JSON) to my web application(java),but i m unable to send the data

i am sending data like this,

$('#tableName').dataTable( {
                    "destroy": true,
                    "processing": true,
                     "serverSide": true,
                    
                     "ajax": {
                            "url": "actionName.action",
                            "contentType": "application/json",
                            "type": "POST",
                            "data": function ( d ) {
                                d.jsonData =json1;
                                return d;
                            }
                          },
                     
                      "ordering": false,
                      "bFilter": false,
                      
                      
                     
                    } );

json1 is my json data ,i m fetching the data in my web application with the name jsonData but getting null.Can you please help me reagrding how to send that data to my web application ,how to fetch the data in my web application(java) ,

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @saivathsow ,

    If you look at the examples for ajax.data, you don't need return d.

    If jsonData is null on the server end, is it null at the point of sending? it would be worth adding some debug on line 11. Also, is json1 valid JSON? If not, use JSON.stringify()

    Hope that helps,

    Cheers,

    Colin

This discussion has been closed.