gpt4 book ai didi

javascript - 如何将json url显示为html?

转载 作者:行者123 更新时间:2023-11-28 18:49:01 24 4
gpt4 key购买 nike

我在jquery中速度很慢,我尝试研究如何显示从url到html的json文件,但似乎我没有得到代码。我只想在这里显示这个json数据:http://api.paperstreetjobs.com/exam/show/getProblems

我想在我的 html 中显示数组中的每个问题和难度值。

我的json:

[
[
{
"id":26,"question":"What html element will the following CSS code selects?\r\n\r\nli:not(#foo) > fieldset > div > span > input[type='radio'], \r\nli:not(#foo) > fieldset > div > span > input[type='checkbox']",
"note":"",
"difficulty":"easy",
"language":"css"
}
],
[
{
"id":18,"question":"Try to figure out what is wrong with the codes below. Explain your answer\r\n\r\n",
"note":"",
"difficulty":"average",
"language":"php"
}
],
[
{
"id":112,
"question":"Assuming there is a sample.json file inside your directory. That contains\r\n{\"1\":{\"id\":1,\"clicks\":100,\"stars\":5},\"2\":{\"id\":2,\"clicks\":120,\"stars\":2},\"3\":{\"id\":3,\"clicks\":60,\"stars\":3}}\r\n \r\nGet the value of the json file\r\nSort the values according to its \u201cstars\u201d descending and \u201cclicks\u201d descending.\r\nReplace the sample.json content to the sorted value assuming that the file is writable.\r\nAssuming that the values changes once a day, your code should adopt to the values of \u201cclicks\u201d and \u201cstars\u201d",
"note":"",
"difficulty":"hard",
"language":"php"
}
]
]

请帮助我并指导我。提前致谢!

最佳答案

很简单。

$.get( "http://api.paperstreetjobs.com/exam/show/getProblems", function( data ) {
$( ".result" ).html( data );
alert( "Load was performed." );
});

您可以使用@Deep代码来渲染它。

最佳

叶戈尔

关于javascript - 如何将json url显示为html?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34800263/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com