Server Side Processing setting dataType to json

Server Side Processing setting dataType to json

scottkmitch1scottkmitch1 Posts: 9Questions: 3Answers: 0
edited May 2014 in DataTables 1.10

Is there a way (besides using the function type for "ajax" key) to set the dataType field of the ajax request? For example (see code below) if I set the "dataType" key I don't see any changes in the request Content-Type (it is always Content-Type:application/x-www-form-urlencoded; charset=UTF-8). I have seen that the dataType key is usable to some extent in the following example [Datatables JSONP] (http://www.datatables.net/examples/server_side/jsonp.html).

"ajax": {
            "url": "ajax/status",
            "type": "POST",
            "dataType": "json",
            "data": function(d) {
                return JSON.stringify(d);
            }
}

This question has an accepted answers - jump to answer

Answers

  • scottkmitch1scottkmitch1 Posts: 9Questions: 3Answers: 0

    Not the best question but I think copy/paste from a GET request factored in....just incase it is a helpful reminder to anyone else

    contentType: 'application/json'
    

    was the attribute I was missing...

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Good to hear you got a solution for this - thanks for sharing it with us.

    Allan

This discussion has been closed.