JQuery ajax post throws error

When I try to send data to the server using Jquery POST I get the following error.

What am I doing wrong?

  $('.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: Illegal invocation at 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) at Function.r.param (https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:4:7918) at Function.ajax (https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:4:12227) at Function.r.(anonymous function) [as post] (https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:4:14489) at HTMLButtonElement. (http://localhost:3000/view-users:62:9) at HTMLButtonElement.dispatch (https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:3:10316) at 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.(anonymous function) @ jquery.min.js:4 (anonymous) @ view-users:62 dispatch @ jquery.min.js:3 q.handle @ jquery.min.js:3

**


Did you check the value of rowUserData

var rowUserData = rowUser.find(":input").val()

It should not return HTML elements.

链接地址: http://www.djcxy.com/p/28658.html

上一篇: 引发TypeError的jQuery Ajax

下一篇: jQuery ajax后抛出错误