发送数据会给出[object HTMLInputElement]作为查询响应

发送数据会给出[object HTMLInputElement]作为查询响应,html,ajax,forms,api,Html,Ajax,Forms,Api,我正在尝试向合作伙伴端点发送用户表单数据,如下所示: $('#registrationFrm').on('submit', function(e){ e.preventDefault(); $.ajax({ type: "POST", url: "https://pixel.plexop.com/?country="+countryid+"&_v=6&name="+firstName+"&lastnam

我正在尝试向合作伙伴端点发送用户表单数据,如下所示:

$('#registrationFrm').on('submit', function(e){
e.preventDefault();
$.ajax({
type: "POST",
url: "https://pixel.plexop.com/?country="+countryid+"&_v=6&name="+firstName+"&lastname="+lastName+"&phone="+phone
+"&email="+emailid+"&ud=&e=2&adv=1&a=4&f=221161&FormId=1807&SerialId=1210053",
data: $("#registrationFrm").serialize(),
success: function() {
alert('success');
 }
});
});
<form id="registrationFrm" >
      <div class="form-group has-feedback">
        <input type="text" class="form-control" placeholder="First Name" name="firstName" id="firstName" required />
        <span class="glyphicon glyphicon-user form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="text" class="form-control" placeholder="Last Name" name="lastName" id="lastName" required />
        <span class="glyphicon glyphicon-user form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="tel" class="form-control" placeholder="Phone No" name="phone" id="phone" required />
        <span class="glyphicon glyphicon-earphone form-control-feedback"></span>
我返回200 OK,但从数据开始,当我在网络上检查它时,我会发送此信息:

Query string: country   "[object HTMLSelectElement]
Query string: name  "[object HTMLInputElement]
Query string: lastname  "[object HTMLInputElement]"
我的表单如下所示:

$('#registrationFrm').on('submit', function(e){
e.preventDefault();
$.ajax({
type: "POST",
url: "https://pixel.plexop.com/?country="+countryid+"&_v=6&name="+firstName+"&lastname="+lastName+"&phone="+phone
+"&email="+emailid+"&ud=&e=2&adv=1&a=4&f=221161&FormId=1807&SerialId=1210053",
data: $("#registrationFrm").serialize(),
success: function() {
alert('success');
 }
});
});
<form id="registrationFrm" >
      <div class="form-group has-feedback">
        <input type="text" class="form-control" placeholder="First Name" name="firstName" id="firstName" required />
        <span class="glyphicon glyphicon-user form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="text" class="form-control" placeholder="Last Name" name="lastName" id="lastName" required />
        <span class="glyphicon glyphicon-user form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="tel" class="form-control" placeholder="Phone No" name="phone" id="phone" required />
        <span class="glyphicon glyphicon-earphone form-control-feedback"></span>

我在这里做错了什么?

可能,您将变量定义为:

const firstName = document.getElementById('firstName');
/*and so*/
但你应该这样做:

const firstName = document.getElementById('firstName').value;
UPD:


你能发布一个完整的代码示例吗?查看countryid、firstName、lastName、phone和emailid的所有var声明,以及表单字段的相关HTML都会有所帮助。因此,您正在URL和请求正文中发送数据?我根本没有向其中添加任何常量。这应该在index.html中实现吗?您最好这样做,但您可以这样做:再次检查我的答案