javascript - $.each functionality differs with object type -
when $.each statement looks this:
$.each($(".permissions"), function (index, element) { ... }).promise().done(function () {...}); it works.
when $.each statement looks this:
$.each(dataobj, function (index, element) { }.promise().done(function () {...}); returns error:
$.each.promise not function
why that? can workaround?
there ajax script in done function want run after $.each avoid race condition.
you don't need .promise() here @ all. $.each synchronous, there never "race condition" here. code not continue until $.each finished.
just run $.ajax call when $.each done.
$.each(dataobj, function (index, element) { }); $.ajax({});
Comments
Post a Comment