Javascript 从json到ul的链接和文本
你能帮我解释一下为什么这不起作用吗Javascript 从json到ul的链接和文本,javascript,jquery,json,Javascript,Jquery,Json,你能帮我解释一下为什么这不起作用吗 $.ajax({ 网址:'https://api.import.io/store/connector/b5caf0ef-1e6b-4fba-9fa4-21e475196673/_query?input=webpage/url:http%3A%2F%2Fnuzzel.com%2FWAStatzz%3Fsort%3Dfriends%26when%3D2&&_apikey=e4fb993c758a43dda0ca9135d3b3264deebed4b302b0d3
$.ajax({
网址:'https://api.import.io/store/connector/b5caf0ef-1e6b-4fba-9fa4-21e475196673/_query?input=webpage/url:http%3A%2F%2Fnuzzel.com%2FWAStatzz%3Fsort%3Dfriends%26when%3D2&&_apikey=e4fb993c758a43dda0ca9135d3b3264deebed4b302b0d342e2b3fabb2b49afc9c14493d0d53d65d0ea2a0fd19b45f6d10cda5252f76410921188d38cb4e6db8fc28527d64207329b2c86bdc5119bac97'
}).完成(功能(数据){
控制台日志(数据);
var html=“”;
$.each(数据、结果、功能(索引、项目){
html+=“”;
html+=“- ”
”;
html+=“- ”+item.description+”
”;
html+=“
”;
});
setTimeout(函数(){
$(“.container”).append(html);
}, 1500);
})
您在这两行的报价中有一些问题
html += "<li>" <a href="['headline']"> + item['headline/_text'] + "</a>""</li>";
html += "<li>" + item.description + "</li>";
html+=“” ”;
html+=“”+item.description+” ”;
应该是这样的
html += "<li><a href='" + item['headline'] + "'>" + item['headline/_text'] + "</a></li>";
html += "<li>" + item.description + "</li>";
html+=“”;
html+=“”+item.description+” ”;
更新小提琴:
编辑:对不起,只有第一行。这是跨域AJAX吗?你还可以分享数据的输出结果吗?你能解释一下你想要达到的目标吗?你犯了什么错误?第一个突出的问题。。。您尝试创建锚定标记的方式。这将导致语法错误。请打开浏览器控制台查看错误报告。谢谢你是我的英雄:D