デフォルトのパラメータを使用する再利用可能なJavaScript
関数を作成しようとしています。しかし、IDE
は私に何か間違っていると警告しています。PhpStorm - 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();
}
});
});
}
私は実際にそれと間違っているのか分からないのですか?あなたは何が起こっているのか理解してもらえますか? JavaScriptを&は、選択フィールドをクリックするために
1. Ctrlキーを押しながら+ ALT + S
検索:
ES6を使用していますか? –
http://stackoverflow.com/questions/894860/set-a-default-parameter-value-for-a-javascript-function –
どちらが確実かわかりません。それは最新のIDEバージョンなので、私はES6を想定していますか? –