Skip to content
This repository has been archived by the owner on Jun 26, 2022. It is now read-only.

Commit

Permalink
Add support for contentType in utils.ajax. Used in backbone.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Nov 3, 2013
1 parent 709402a commit 7bda15f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/dom-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ utils.ajax = (function() {
var xhr = new XMLHttpRequest();
var deferred = Backbone.Deferred && Backbone.Deferred();

if (options.contentType) {
if (options.headers == null) options.headers = {};
options.headers['Content-Type'] = options.contentType;
}
if (options.credentials) options.withCredentials = true;
xhr.addEventListener('readystatechange', end(xhr, options, deferred));
xhr.open(options.type, options.url, true);
Expand Down

0 comments on commit 7bda15f

Please sign in to comment.