PhpStorm-JavaScript函数参数IDE错误
作者:互联网
我正在尝试构建一个使用默认参数的可重用JavaScript函数.但是,IDE警告我做错了事.
代码是这样的:
function standardAjaxRequest(process_script_path, redirect = false) {
var loading = $(".loading");
var response_message = $(".response_message");
// runs the ajax to add the entry submitted
form.on("submit", function(event) {
event.preventDefault();
removeNoticeError();
var data = form.serialize();
$.ajax({
url: process_script_path,
type: "POST",
dataType: "json",
data: data,
cache: false,
success: function(response) {
if(response.status === false)
{
response_message.addClass("error").text(response.message).fadeIn(1);
}
else
{
response_message.addClass("notice").text(response.message).fadeIn(1);
if(redirect)
{
setTimeout(function () {
window.location.reload();
}, 1000);
}
else
{
response_content.after(response.content);
}
}
},
error: function() {
response_message.addClass("error").text("There was a problem adding your entry.").fadeIn(1);
},
beforeSend: function() {
toggleLoading();
},
complete: function() {
toggleLoading();
}
});
});
}
我真的不知道这是怎么回事?您能帮我了解发生了什么吗?
解决方法:
您可以在此处切换版本:
1.
按CTRL ALT S
2
搜索JavaScript和单击选择字段.然后选择ECMAScript 6
标签:default-parameters,javascript,function,parameters 来源: https://codeday.me/bug/20191010/1887188.html