【发布时间】:2016-09-07 10:27:10
【问题描述】:
我正在尝试使用 AJAX 提交一个简单的表单。我正在使用 grunt 作为任务运行程序来编译我的 JS 文件等等。
这是我到现在为止所做的。
$("form").submit(function(event) {
event.preventDefault();
var formData = {
$("#username").val(),
$("#password").val()
};
$.ajax({
url: 'xxx',
type: 'POST',
dataType: 'json',
data: formData,
encode: true
})
.done(function(data) {
console.log(data);
})
});
我怀疑任务即将运行时出现 JSHint 错误
$("#username").val(), ^ 'concise methods' 在 ES6(使用 esnext 选项)或 Mozilla JS 扩展(使用 moz)中可用。
这是我的 gruntfile(jshint 任务)
jshint: {
ignore_warning: {
options: {
'-W099': true,
/*'-W041': true,*/
'-W044': true,
'-W033': true,
'-W043': true,
'-W049': true,
'-W004': true,
'-W065': true,
'-W083': true, // Corrigir futuramente
},
src: ['public/_assets/src/js/modules/*.js'],
}
}
这到底是什么意思?我该如何解决这个错误?
谢谢!
【问题讨论】:
标签: javascript jquery gruntjs ecmascript-6 jshint