将JSON问题发布到API并显示数据 [英] Post JSON question to API and display data
本文介绍了将JSON问题发布到API并显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在简单的HTML div中显示来自API的一些数据,如果有人可以帮我处理下面的代码,那将会非常有用。这是API:http://api.scb.se/OV0104/v1/doris/sv/ssd/START/JO/JO0601/SkordarL
这是我要发送的JSON问题:
{
query:[
{
code:Region,
选择:{
过滤器:vs:RegionRiket99,
值:[]
}
},
{
代码:格罗达,
选择:{
过滤器:项目,
值:[
50
$
}
},
{
代码:ContentsCode,
选择:{
filter:item ,
值:[
JO0601L2
]
}
},
{
代码:Tid ,
选择:{
过滤器:项目,
值:[
2000,
2001,
2002,
2003,
2004,
2005,
20 06,
2007,
2008,
2009,
2010,
2011,
2012 ,
2013,
2014,
2015,
2016,
2017
]
}
}
],
回复:{
格式:px
}
}
我尝试了什么:
这是我到目前为止的AJAX请求:
$。ajax({
url:http://api.scb.se/OV0104/v1/doris/sv/ssd/START/JO/ JO0601 / SkordarL,
类型:POST,
dataType:'json',
成功:function(){
console.log();
},
错误:函数(错误){
console.log(错误!,错误);
}
});
感谢您的任何建议!
// Chris
解决方案
.ajax({
url:http://api.scb.se/OV0104/v1/doris/sv/ssd/START / JO / JO0601 / SkordarL,
类型:POST,
dataType:'json',
成功:function(){
console.log();
},
错误:函数(错误){
console.log(错误!,错误);
}
});
感谢您的任何建议!
//克里斯
I want to show some data from an API in a simple HTML div and it would be super helpful if anyone could help me with my code below. Here is the API: http://api.scb.se/OV0104/v1/doris/sv/ssd/START/JO/JO0601/SkordarL
Here is the JSON question that I want to send:
{ "query": [ { "code": "Region", "selection": { "filter": "vs:RegionRiket99", "values": [] } }, { "code": "Groda", "selection": { "filter": "item", "values": [ "50" ] } }, { "code": "ContentsCode", "selection": { "filter": "item", "values": [ "JO0601L2" ] } }, { "code": "Tid", "selection": { "filter": "item", "values": [ "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017" ] } } ], "response": { "format": "px" } }
What I have tried:
Here is my AJAX request so far:
$.ajax({ url: "http://api.scb.se/OV0104/v1/doris/sv/ssd/START/JO/JO0601/SkordarL", type: "POST", dataType:'json', success: function () { console.log(); }, error: function(error){ console.log("Error!", error); } });
Thanks for any advice!
//Chris
解决方案
.ajax({ url: "http://api.scb.se/OV0104/v1/doris/sv/ssd/START/JO/JO0601/SkordarL", type: "POST", dataType:'json', success: function () { console.log(); }, error: function(error){ console.log("Error!", error); } });
Thanks for any advice!
//Chris
这篇关于将JSON问题发布到API并显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文