editor triggering submitErrror regardless of success (server-side processing)
editor triggering submitErrror regardless of success (server-side processing)
danwinters5
Posts: 4Questions: 2Answers: 0
My editor is configured with ajax param as a url and it's triggering the sumbitError callback regardless of success/fail.
The issue seems to be below in _ajax. $isPlainObject(json) is returning false for well-formed json in xhr.responseJSON. In my case the content type is "application/json; charset=utf-8"
Editor.prototype._ajax = function ( data, success, error )
{
var thrown;
var opts = {
type: 'POST',
dataType: 'json',
data: null,
error: [ function ( xhr, text, err ) {
thrown = err;
} ],
complete: [ function ( xhr, text ) {
// Use `complete` rather than `success` so that all status codes are
// caught and can return valid JSON (useful when working with REST
// services).
var json = xhr.status === 204 ?
{} :
xhr.responseJSON;
if ( $.isPlainObject( json ) ) {
success( json );
}
else {
error( xhr, text, thrown );
}
} ]
};
This discussion has been closed.
Answers
Could you let me know what version of jQuery you are using? I tracked down a compatibility issue between Editor 1.6.0 and jQuery older than 1.12 (i.e. 1.11 and earlier) earlier today.
If that's the issue I can send an updated version or the patch.
Editor 1.6.1 will be released in the next few days with the fix.
Allan
That would be it, I'm using version 1.9.
Can you update to a newer jQuery, or would you like the patch? I can send it over when I get into the office tomorrow. Or if you hang on until Friday, I expect to release 1.6.1 then.
Allan
Thanks, I can hang on til Friday. The jQuery version is bundled and I can't update it.