jQuery.ajax(): A listing of allowed values for property contentType, other than default ?
Hi
For jQuery.ajax(), is there a listing of the allowed values that can be assigned to property
contentType that it can process?
I am performing jQuery.ajax() with the following property settings:
type is "post" and
dataType is "json" .
Property
contentType's default value is:
"
application/x-www-form-urlencoded; charset=UTF-8" , and if I assign the same default value to this property, then jQuery.ajax() works fine and creates a well-formed POST request body.
However, if I use "application/json; charset=UTF-8" , the jQuery.ajax() aborts without any useful error message, just "error", and fails to create a POST request body but creates instead a malformed OPTIONS request body.
Note: This issue only occurs on Mozilla Firefox and Google Chrome, not IE9.
- $.ajax({
url: url,
type: "post",
dataType: "json",
contentType: 'application/json',
data: data,
success: successCallback,
error: errorCallback,
complete: completeCallback
});
So, is there an acceptable list of contentType values that jQuery.ajax() will allow?
Thanks
Jeff in Seattle