javascript - undefined error for callback function in jquery -
i'm trying perform actions using jquery diferred
in script. when execute script produces error typeerror: func(...) undefined
. function defined , accepting calls.
here script:
verify: function(func, $this, verpass) { console.log('in verify'); var data = {}; data.url = 'service/verifier.php'; data.data = {pass: verpass}; data.async = true; this.fetch(data).always(function() { var result=true; if (result) { console.log(func); func().then(function(){ //here i'm getting error( fiddle line no:149) $('#loader').children('.infocont').empty().append($('<span/>').css({'color': '#000', 'background': '#35cc83', 'display': 'inline-block', 'margin': '0 0 0 -115px', 'padding': '0 25px 7px'}).html('<h2>profile updated successfully</h2>')); console.log('success'); settimeout(function() { $('#loader').fadeout("slow"); $this.closest('.modal').modal('hide'); }, 2000); }, function(){ console.log('failed'); $('#loader').fadeout("slow"); $this.closest('form').find('.warning-mes').empty().append($('<span/>').css({'color': '#000', 'background': '#ffebe8'}).html('failed complete action. please try again...')); }); } else { $('#loader').fadeout("slow"); $this.closest('form').find('.warning-mes').empty().append($('<span/>').css({'color': '#000', 'background': '#ffebe8'}).html('incorrect password')); } }); }
and have created 2 fiddles. 1 original script , dummy. dummy script works expected. i'm not able figure out mistake have made in original script.
please me solve issue.
Comments
Post a Comment