Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/462.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQueryAjax帖子中出现400(错误请求)错误_Javascript_Jquery_Html_Ajax_Cordova - Fatal编程技术网

Javascript jQueryAjax帖子中出现400(错误请求)错误

Javascript jQueryAjax帖子中出现400(错误请求)错误,javascript,jquery,html,ajax,cordova,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",

我试图使用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);
    }
})

我是新来电话gap的,请更正我上面的附加代码,谢谢您的帮助。

您可能需要整理您的数据

data: JSON.stringify({"CustName":"naveen", 
    "Mobile": 9490429799, 
    "Email":"naveendodda848@gmail.com",
    "Address":"Hyderabad",
    "Password":12345, 
    "PinCode": 50000,
    "IsServiceProvider":"false",
    "Is_Blocked":"false"}), 

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

data: JSON.stringify({"CustName":"naveen", 
    "Mobile": 9490429799, 
    "Email":"naveendodda848@gmail.com",
    "Address":"Hyderabad",
    "Password":12345, 
    "PinCode": 50000,
    "IsServiceProvider":"false",
    "Is_Blocked":"false"}), 

再次感谢您的回复我收到的错误为POST 500(内部服务器错误)@naveendoda您的192.168.3.118:2244/api/Customer/PostTblCustomer页面包含错误再次感谢您的回复我收到的错误为POST 500(内部服务器错误)@NaveEndoda您的192.168.3.118:2244/api/Customer/PostTblCustomer页面包含错误该调用可与postman或其他ajax工具一起使用?该错误是否在真实设备或模拟器/浏览器中显示?该调用可与postman或其他ajax工具一起使用?错误是否在真实设备或模拟器/浏览器中显示?