jquery file upload not working with jquery 3.x -
my script works fine jquery 1.x , 2.x, doesn't work jquery 3.x
imageinput.fileupload(); var jqxhr = imageinput.fileupload('send', { files: files, formdata: $.extend({csrfmiddlewaretoken: csrftoken}, attachmentdata), url: {{ id }}_settings.url.upload_attachment, }) .success(function (result, textstatus, jqxhr) { $.each(result.files, function (index, file) { console.log('success'); }); }) .error(function (jqxhr, textstatus, errorthrown) { console.log('error occurred.'); });
the ff browser complains success
, error
function not found.
jquery.deferred exception: imageinput.fileupload(...).success not function .... undefined
this error message. thank help.
jquerys success
, error
part of $.ajax
, in
$.ajax({ success : function() {}, error : function() {} })
but $.ajax
starter returning deferreds, changed done
, fail
$.ajax({}).done().fail()
this caused confusion, identical methods called success
, error
added well, 1 do
$.ajax({}).success().error()
the decision remove success
, error
made in release of jquery 3.x
you can swap in done
, fail
direct replacements in code success
, error
fileupload plugin uses jquery's $.ajax under hood.
jquery's deferreds promise a+ compliant, 1 use then
, catch
well
Comments
Post a Comment