在jquery ajax POST中获取400(错误请求)错误

时间:2016-03-22 07:02:11

标签: javascript jquery html ajax cordova

我正在尝试使用jquery发送Ajax POST请求,但我收到400(错误请求)错误 这是我的代码:

$.ajax({
       url: "http://192.168.3.118:2244/api/Customer/PostTblCustomer",
       type: "POST",
    data: {"CustName":"naveen", 
    "Mobile": 9490429799, 
    "Email":"naveendodda848@gmail.com",
    "Address":"Hyderabad",
    "Password":12345, 
    "PinCode": 50000,
    "IsServiceProvider":"false",
    "Is_Blocked":"false"},

    dataType: "json",
     contentType:"application/json",

    success: function(data){
        alert("success");
        alert(data);
        console.log(data);
    },
    error: function (xhr, ajaxOptions, thrownError) {
      alert(xhr.status);
      alert("error");
      alert(thrownError);

       console.log(xhr.status)
      console.log(thrownError);
       console.log(ajaxOptions);
    }
})

我是电话新手的新手请在上面提供我的上述附件代码

1 个答案:

答案 0 :(得分:0)

您可能需要对数据进行字符串化

$('#second option:selected').text() + ' on ' + $("#datepicker").val()