jQuery Ajax发布引发错误

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

**

1个回答


您是否已检查 rowUserData </ strong> </ p>的值

  var rowUserData = rowUser.find(“:input”)。val()
</ code> </ pre>

它不应返回HTML元素。</ p>
     </ div>

展开原文

原文

Did you check the value of rowUserData

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

It should not return HTML elements.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐