0

I use the following ajax script to POST JSON object.

$.ajax({
            url: url,
            type: "POST",
            data: jsonData,
            dataType: "json",
            contentType: "application/json; charset=utf-8;",
            success: function (data) {
                $('#dialog-placeholder').html('OK');
            },
            error: function (xhr, textStatus, errorThrown) {
                $('#dialog-placeholder').html('Bad');
            }
        });

In Edge, Firefox, Chrome it works fine. Unfortunately in Internet Explorer it shows me following error.

400 Bad Request
The collection of headers 'content-type,accept' is not allowed.
maciejka
  • 818
  • 2
  • 17
  • 42

2 Answers2

0

Try using the ajax post short-hand instead. Give it a try!

$.post

https://jsfiddle.net/1c4cx668/

0

Can you please try this :

$.ajax({
            url: url,
            type: "POST",
            data: JSON.stringify(jsonData),
            dataType: "json",
            contentType: "application/json; charset=utf-8;",
            success: function (data) {
                $('#dialog-placeholder').html('OK');
            },
            error: function (xhr, textStatus, errorThrown) {
                $('#dialog-placeholder').html('Bad');
            }
        });
Sourabh
  • 500
  • 2
  • 14