How does editor send data to restful server in application/json format?

How does editor send data to restful server in application/json format?

juningwjuningw Posts: 1Questions: 1Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Hi,

In my app, I need to do CRUD operation on rows. I prefer to standard restful server, such as POST/DELETE. I know the ajax option(CREATE, EDIT...), but the recieved HTTP packages are of "content-type:"application/x-www-form-urlencoded; charset=UTF-8"".

How can I send ajax data to server in application/json format?

thanks!

Answers

  • YOMYOM Posts: 53Questions: 22Answers: 1

    Using the ajax option. For example:

    ajax: {
      url: "https://myapiendpoint.com/v1",
      contentType: "application/json",
      type: "POST",
      data: function ( d ) {
        return JSON.stringify( d );
      }
    }
    
  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    This example here should help, it's demonstrating that.

    Colin

This discussion has been closed.