jquery - ajax 调用的输入意外结束
问题描述
这是我在 Laravel 项目中的代码
$('.add').submit(function(e) {
e.preventDefault();
let form = $(this).closest('form'),
fd = form.serializeArray(),
postId = $('input[name=post_id]').val();
$.ajax({
headers: {
'X-CSRF-TOKEN': $('.csrf-token').val()
},
type: "POST",
url: "posts/" + postId + "/comment",
dataType: "JSON",
data: fd,
success: function(res) {
console.log(res)
},
error: function(error) {
console.log(res)
}
});
})
这是我的错误- Uncaught SyntaxError: Unexpected end of input
解决方案
推荐阅读
- javascript - 如何更正这个错误的 Jquery 代码?
- node.js - 如何在数据库中使用 i18n
- python - 如何从 Python 的响应中只取 1 个值?
- python - 运行简单的 Python 计算器时出现逻辑错误
- kotlin - Database Room Dao Getter 为国家列表返回 null
- javascript - 如何在material-ui中将非提交按钮优先于提交按钮?
- c# - 如何将列表框项保存到项目设置
- sql - 在 SQL 中将时间戳转换为当前时间格式
- c# - C#如何将一个项目从另一个类添加到列表中
- redux - 在redux中重新选择createSelector返回未定义