未解析的函数或方法 done()
Unresolved function or method done()
我正在处理一个带有联系表的项目,但我的 PhpStorm 或 jQuery 给了我一个非常烦人的警告:
Unresolved function or method done()
我试过 this solution 因为它看起来非常相似,但它对我不起作用。可能是因为那个 post 和问题是从 2014 年开始的。
我有这台 ATM:
.done(function(data) {
/*some code*/
});
并且 done
函数始终显示此警告。该功能和我所有的联系方式都很好用,但很烦人。
有人对此有更新的修复吗?因为我知道它为什么这样做是因为阅读了这样的 posts 但他们的修复仍然没有为我做。
我知道这可能是重复的。但是之前的修复可能已经过时了。我希望你明白这就是我创建这个 post 的原因。
编辑
.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>');
}
});
我看到有些人投票决定关闭它,因为它应该是一个错字。钩子在我的代码中。所以这不是错字。
我的问题是如何修复显示标题中提到的错误的警告。
PhpStorm 缓存了大量文件,因此系统缓存可能有一天会超载。在某些情况下,缓存将不再需要,例如,如果您经常处理短期项目。 此外,解决某些冲突的唯一方法是清理缓存。
清理系统缓存:
在主菜单上,选择文件 |使 Caches/Restart 无效。 Invalidate Caches 消息出现,通知您缓存将在下次启动时失效并重建。使用对话框中的按钮使缓存无效,重新启动 PhpStorm 或两者。
请务必注意以下几点:
直到 PhpStorm 重新启动,这些文件才真正被删除。
打开和关闭项目不会导致删除任何文件。
Source link here
我正在处理一个带有联系表的项目,但我的 PhpStorm 或 jQuery 给了我一个非常烦人的警告:
Unresolved function or method done()
我试过 this solution 因为它看起来非常相似,但它对我不起作用。可能是因为那个 post 和问题是从 2014 年开始的。
我有这台 ATM:
.done(function(data) {
/*some code*/
});
并且 done
函数始终显示此警告。该功能和我所有的联系方式都很好用,但很烦人。
有人对此有更新的修复吗?因为我知道它为什么这样做是因为阅读了这样的 posts 但他们的修复仍然没有为我做。
我知道这可能是重复的。但是之前的修复可能已经过时了。我希望你明白这就是我创建这个 post 的原因。
编辑
.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>');
}
});
我看到有些人投票决定关闭它,因为它应该是一个错字。钩子在我的代码中。所以这不是错字。
我的问题是如何修复显示标题中提到的错误的警告。
PhpStorm 缓存了大量文件,因此系统缓存可能有一天会超载。在某些情况下,缓存将不再需要,例如,如果您经常处理短期项目。 此外,解决某些冲突的唯一方法是清理缓存。
清理系统缓存:
在主菜单上,选择文件 |使 Caches/Restart 无效。 Invalidate Caches 消息出现,通知您缓存将在下次启动时失效并重建。使用对话框中的按钮使缓存无效,重新启动 PhpStorm 或两者。 请务必注意以下几点:
直到 PhpStorm 重新启动,这些文件才真正被删除。 打开和关闭项目不会导致删除任何文件。 Source link here