FIX: Reading response header instead of hacking to get json type

This commit is contained in:
Mellisa Hankins 2013-07-11 19:50:17 +10:00
parent 3e49c1ff9f
commit 5c1764ad23

View File

@ -135,15 +135,10 @@
type: "POST",
context: $(this)
}).done(function(r) {
// A bit hacky, but it checks if the response is json
try {
$.parseJSON(r);
if(r.message) {
var msgType = r.messageType ? r.messageType : 'good';
statusMessage(decodeURIComponent(r.message), msgType);
}
} catch(e) { }
if(xhr.getResponseHeader('content-type').indexOf('json') >= 0 && r.message) {
var msgType = r.messageType ? r.messageType : 'good';
statusMessage(decodeURIComponent(r.message), msgType);
}
$(this).parents('.ss-gridfield').entwine('.').entwine('ss').reload();
});