Reputation: 129
Please take a look at this jsFiddle: http://jsfiddle.net/xY7tx/3108/
When I run getJSON
in the above sample, why is the fail
part always triggered?
I would really appreciate if one tell me how with jQuery (or even with pure Javascript) How could get the key and value of the JSON file.
My goal is after getting the key (title
) and the value (video_url
) then insert them all into a list ul
which the items of the list are the keys and the href
are their values. Thanks
Upvotes: 0
Views: 59
Reputation: 2743
Because it's not JSON data. You're getJSON
ing an HTML page.
Try it with the following link:
$.getJSON("https://raw.githubusercontent.com/xldrx/kodi-persian-contents/master/movies/movies.json", function(d) {
console.log(d);
}).fail( function(d, textStatus, error) {
alert("getJSON failed \n , status: " + textStatus + "\n "+ ", error: "+error + "\n")
});
As for the list, not sure I fully understood your requirement, but is this what you're looking for: https://jsfiddle.net/p77ymjgx/ ?
Upvotes: 2