2017-11-21 17 views
0

次のajaxスクリプトを使用してPOST JSONオブジェクトを使用します。POST Jsonオブジェクトajaxスクリプト(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'); 
      } 
     }); 

Edge、Firefox、Chromeではうまく動作します。残念ながら、Internet Explorerでは、それは私の後にエラーが表示されます。

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

私がAspネットのWeb APIでCORSを使用しています。 – maciejka

+0

contentType属性を削除します。 – Jar3d

+0

は外部のajax URLですか? – Sourabh

答えて

0

あなたはこれを試してみてくださいすることができ:

$.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

同じ結果です。 – maciejka

+0

knockout jsを使用してこれを以前のJSONに文字列化しました。 – maciejka

+0

同じ問題がここにチェックアウトしてください。https://stackoverflow.com/questions/16017081/getting-400-bad-request-error-in-jquery-ajax-post – Sourabh

関連する問題