【问题标题】:Unresolved function or method done()未解决的函数或方法 done()
【发布时间】:2017-03-24 11:19:57
【问题描述】:

我正在处理一个带有联系表单的项目,但我的 PhpStorm 或 jQuery 给了我一个非常烦人的警告:

未解析的函数或方法 done()

我尝试过this solution,因为它看起来非常相似,但对我不起作用。也许是因为那个帖子和问题是从 2014 年开始的。

我有这个 ATM:

 .done(function(data) {

  /*some code*/

 });

done 函数始终显示此警告。该功能和我所有的整个联系表格都运行良好,但很烦人。

有人对此有更新的修复吗?因为我知道它为什么这样做,因为阅读了这样的帖子,但他们的修复仍然没有为我做。

我知道这可能是重复的。但是之前的修复可能已经过时了。我希望你明白这就是我创建这篇文章的原因。


编辑

.done(function(data) {

            // here we will handle errors and validation messages
            if (!data.success) {

               // handle errors for name ---------------
                if (data.errors.name) {
                    $('#name').parent().parent().addClass('has-error'); // add the error class to show red input
                    $('#name').parent().parent().append('<div class="help-block alert-danger">' + data.errors.name + '</div>'); // add the actual error message under our input
                }
                // handle errors for email ---------------
                if (data.errors.email) {
                    $('#email').parent().parent().addClass('has-error'); // add the error class to show red input
                    $('#email').parent().parent().append('<div class="help-block alert-danger">' + data.errors.email + '</div>');
                }
                // handle errors for phone ---------------
                if (data.errors.phone) {
                    $('#phone').parent().parent().addClass('has-error'); // add the error class to show red input
                    $('#phone').parent().parent().append('<div class="help-block alert-danger">' + data.errors.phone + '</div>');
                }
                // handle errors for comments ---------------
                if (data.errors.comments) {
                    $('#comments').parent().parent().addClass('has-error'); // add the error class to show red input
                    $('#comments').parent().parent().append('<div class="help-block alert-danger">' + data.errors.comments + '</div>');
                }

                if (data.errors.error) {
                    $('#contact-form').append('<div class="help-block alert-danger">' + data.errors.error + '</div>'); // add the actual error message                    
                } 

            }
            else {
                // ALL GOOD! just show the success message!
                // empty all inputs
                // feedback.show()
                $('#contact-form').append('<div class="alert alert-success pull-left collapse">' + data.message + '</div>');
            }
        });

我看到有些人投票决定关闭它,因为它应该是一个错字。钩子在我的代码中。所以这不是一个错字。

我的问题是如何修复显示标题中提到的错误的警告。

【问题讨论】:

标签: javascript jquery phpstorm webstorm


【解决方案1】:

PhpStorm 缓存了大量文件,因此系统缓存可能有一天会过载。在某些情况下,将不再需要缓存,例如,如果您处理频繁的短期项目。 此外,解决某些冲突的唯一方法是清除缓存。

清除系统缓存:

在主菜单上,选择文件 |使缓存无效/重新启动。将出现 Invalidate Caches 消息,通知您缓存将在下次启动时失效并重建。使用对话框中的按钮使缓存无效,重新启动 PhpStorm 或两者兼而有之。 请务必注意以下几点:

直到 PhpStorm 重新启动,文件才真正被删除。 打开和关闭项目不会导致删除任何文件。 Source link here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-26
    • 1970-01-01
    • 1970-01-01
    • 2017-12-02
    • 2017-01-24
    • 1970-01-01
    相关资源
    最近更新 更多