Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jquery中回调函数的未定义错误_Javascript_Jquery_Function_Callback - Fatal编程技术网

Javascript jquery中回调函数的未定义错误

Javascript jquery中回调函数的未定义错误,javascript,jquery,function,callback,Javascript,Jquery,Function,Callback,我试图通过使用脚本中的jquery来执行一些操作。但是当我执行脚本时,它会产生错误TypeError:func。。。没有定义。但是函数已经定义,并且它也接受调用 这是我的剧本: verify: function(func, $this, verPass) { console.log('In verify'); var data = {}; data.url = 'service/verifier.php';

我试图通过使用脚本中的jquery来执行一些操作。但是当我执行脚本时,它会产生错误TypeError:func。。。没有定义。但是函数已经定义,并且它也接受调用

这是我的剧本:

        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 to complete the 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'));
                }
            });
        }
我还创作了两把小提琴。一个是原始脚本,另一个是虚拟脚本。但虚拟脚本的工作原理与预期一致。我不知道我在原剧本中犯了什么错误


请任何人帮助我解决此问题。

请在问题中提及问题出现的时间!在原来的小提琴你。它看起来很有效。@C-link当我提交密码问题时appears@Andy你是什么意思…TypeError:Object[Object Object]没有方法“model”-$target.modal