MS EDGE is URL encoding an AJAX POST call

565 views Asked by At

I have an $.ajax call that is getting encoded with URL encoding. One thing I need to specify is this only happens in Microsoft Edge. Chrome and Firefox work fine with no issues.

Here is my Ajax call

var promise = $.ajax({
   url: "/webapp/CustomPricing/StartPricing",
   type: "POST",
   contentType: 'application/json',
   data: {
      "model": JSON.stringify(this.model),
      "numHandlingUnits": this.handlingUnitsCount,
      "handlingUnits": this.commoditiesCount
   },
   xhrFields: {
      withCredentials: true
   }
});

Any ideas?

1

There are 1 answers

2
hanshenrik On BEST ANSWER

Wrap JSON.stringify around data

JSON.stringify({
  "model": JSON.stringify(this.model),
  "numHandlingUnits": this.handlingUnitsCount,
  "handlingUnits": this.commoditiesCount
})