2017-11-21 7 views
0

Ich verwende das folgende Ajax-Skript zum POST-JSON-Objekt.POST Json-Objekt mit Ajax-Skript (Internet Explorer)

$.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 funktioniert es gut. Leider im Internet Explorer zeigt es mir folgenden Fehler an.

400 Bad Request 
The collection of headers 'content-type,accept' is not allowed. 
+0

I Cors Net Web Api in Asp verwenden. – maciejka

+0

Löschen Sie das Attribut contentType. – Jar3d

+0

ist Ajax URL extern? – Sourabh

Antwort

0

Können Sie bitte diese versuchen:

$.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'); 
      } 
     }); 
+0

Das gleiche Ergebnis. – maciejka

+0

Ich habe dies früher zu JSON mit Knockout js stringifizieren. – maciejka

+0

gleiche Frage hier bitte zur Kasse https://StackOverflow.com/Questions/16017081/getting-400-bad-request-error-in-Jquery-ajax-post – Sourabh