Search code examples
javascriptjqueryphpstormwebstorm

Unresolved function or method done()


I'm working on a project with an contact form but my PhpStorm or jQuery gives me an awful annoying warning:

Unresolved function or method done()

I've tried this solution because it looked awfully the same but it did not work for me. Maybe because that post and problem is from 2014.

I have this ATM:

 .done(function(data) {

  /*some code*/

 });

And the done function always displays this warning. The function and all my whole contact form works well but its just annoying.

Does anyone have an updated fix for this? Because I know why it is doing this because of reading the posts like this but still their fixes did not do it for me.

I know this might be duplicate and all. But the fix before may be outdated. I hope you understand that is why I created this post.


EDIT

.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>');
            }
        });

I see some people vote to close this because it should be a typo. The hook is in my code. So this is not a typo.

My question is how to fix the warnings that show the error mentioned in the title.


Solution

  • PhpStorm caches a great number of files, therefore the system cache may one day become overloaded. In certain situations the caches will never be needed again, for example, if you work with frequent short-term projects. Also, the only way to solve some conflicts is to clean out the cache.

    To clean out the system caches:

    On the main menu, choose File | Invalidate Caches/Restart. The Invalidate Caches message appears informing you that the caches will be invalidated and rebuilt on the next start. Use buttons in the dialog to invalidate caches, restart PhpStorm or both. It is important to note the following:

    The files are not actually deleted until PhpStorm restarts. Opening and closing a project does not result in deleting any files. Source link here