Я пытаюсь создать многократно используемую функцию JavaScript
, которая использует параметры по умолчанию. Тем не менее, IDE
предупреждает меня, что я делаю что-то неправильно.PhpStorm - параметр функции JavaScript IDE error
Код это:
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();
}
});
});
}
Я действительно не знаю, что случилось с ним? Не могли бы вы помочь мне понять, что происходит?
Вы используете ES6? –
http://stackoverflow.com/questions/894860/set-a-default-parameter-value-for-a-javascript-function –
Я не уверен, какой из них. Это последняя версия IDE, поэтому я предполагаю ES6? –