javascript - 在 jQuery ajax post 方法中出现错误 400
问题描述
如何解决?
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
var option = {
method: 'POST',
url: 'https://api.hesabfa.com/v1/item/save',
data: {
apiKey: '********',
userId: '********',
password: '********',
item:{
Name: 'name',
Barcode: '345345345345',
ItemType: 0,
Unit: 'k',
BuyPrice: 500000,
SellPrice: 550000,
PurchasesTitle: 'Samsung Galaxy J7',
SalesTitle: 'Samsung Galaxy J7',
Tag: ''
}
}
}
$.ajax(option).done(function(result) {
if (result.Success)
var r = result.Result;
})
.fail(function() {
});
</script>
解决方案
请检查 hesabfa API 文档和必填字段,也许你错过了一些东西。
推荐阅读
- javascript - 编写“实时编码器”
- python - 如何从 Pandas 的 DataFrame 求和后获得最大值?
- java - HmacSHA512 的 TOTP 算法种子长度
- blazor - 我们可以检查 Blazor 中哪个属性未通过验证吗?
- java - 使用 Java 8 从文件中读取数据?
- javascript - 我可以做没有绑定功能的滑块(反应)
- c# - 在 Blazor 组件中以 JSON 格式显示嵌套列表
- javascript - 在悬停时获取元素 ID
- c# - 为什么要在我的 XML 属性中添加命名空间前缀?
- javascript - 当元素的属性为空时删除多维数组中的元素