jQuery ajax后抛出错误
当我尝试使用Jquery POST将数据发送到服务器时,出现以下错误。
我究竟做错了什么?
$('.btnEditUser').click(function () {
console.log('btn edit user clicked')
var rowUser = $(this).parent()
var rowUserData = rowUser.find(":input").val()
var oForm = new FormData()
oForm.append("rowUserData", rowUserData)
console.log("oForm", oForm)
var sUrl = 'edit-user/'
console.log("sUrl ", sUrl);
$.post(sUrl, oForm, function (uData) {
console.log('SUCCESS')
})
})
**
Uncaught TypeError:非法调用e(https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:4:7727)at Ab(https://ajax.googleapis.com /ajax/libs/jquery/3.2.1/jquery.min.js:4:7608)在Function.r.param(https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery。在函数.ajax(https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:4:12227)在Function.r。(匿名函数)[作为帖子](https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:4:14489)在HTMLButtonElement。 (http:// localhost:3000 / view-users:62:9)在HTMLButtonElement.dispatch(https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:3: 10316)在HTMLButtonElement.q.handle(https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:3:8343)e @ jquery.min.js:4 Ab @ jquery.min.js:4 r.param @ jquery.min.js:4 ajax @ jquery.min.js:4 r。(匿名函数)@ jquery.min.js:4(anonymous)@ view-users:62派遣@ jquery.min.js:3 q.handle @ jquery.min.js:3
**
你检查了rowUserData的值吗?
var rowUserData = rowUser.find(":input").val()
它不应该返回HTML元素。
链接地址: http://www.djcxy.com/p/28657.html