Browse Source

add content-type: application/json; charset=utf-8

pull/76/head
tangkikodo 9 years ago
parent
commit
062000de68
  1. 7
      src/storage_manager/config/config.js
  2. 4
      src/storage_manager/model/RemoteStorage.js

7
src/storage_manager/config/config.js

@ -8,7 +8,7 @@ define(function () {
autosave: 1,
// Indicates if load data inside editor after init
autoload: 1,
autoload: 1,
// Indicates which storage to use. Available: local | remote
type: 'local',
@ -49,5 +49,10 @@ define(function () {
//Callback after request
onComplete: function(jqXHR, status){},
// set contentType paramater of $.ajax
// true: application/json; charset=utf-8'
// false: 'x-www-form-urlencoded'
contentTypeJson: false
};
});

4
src/storage_manager/model/RemoteStorage.js

@ -11,6 +11,7 @@ define(['backbone'],
params: {},
beforeSend: function(){},
onComplete: function(){},
contentTypeJson: false
},
/**
@ -32,7 +33,8 @@ define(['backbone'],
complete: this.get('onComplete'),
method: 'POST',
dataType: 'json',
data: fd,
contentType: this.get('contentTypeJson') ? 'application/json; charset=utf-8': 'x-www-form-urlencoded',
data: this.get('contentTypeJson') ? JSON.stringify(fd): fd,
}).always(function(){
if (typeof clb == 'function') {
clb();

Loading…
Cancel
Save