简体   繁体   English

cloudant发布错误的请求

[英]cloudant post bad request

I am trying to post json objects into a cloudant database. 我正在尝试将json对象发布到cloudant数据库中。 Why am I receiving a "400 bad request" response? 为什么我会收到“ 400错误请求”响应?

pos = {
    'lat': position.coords.latitude,
    'long' : position.coords.longitude
    };
    $.ajax({
      type: "POST",
      url: 'http://03353b2e-7d68-462a-b0ab-d5feeae889fd-bluemix.cloudant.com/locations',
      data: pos,
      contentType: "application/json",
      dataType: 'json'
    });

fixed by using 通过使用固定

data: JSON.stringify(pos)

Thanks to Nico O for answer 感谢Nico O的回答

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM