First api call, $.getJSON && $.ajax both NOT working

Hi, you are getting a CORS error, meaning that you don’t have access to the API server. An easy way to avoid this, is by using cors-anywhere.herokuapp.com. Also, jsonp is not a valid argument it should be json. Lastly, the property you are looking for is not verse.text, but verse.verse.details.text.

This code will work:

$.ajax({
  url: "https://cors-anywhere.herokuapp.com/http://www.ourmanna.com/verses/api/get/?format=json&order=random",
  dataType: "json",
  success: function(verse){
    console.log(verse);
    $("#test").html(verse.verse.details.text); 
  }
});

More info (just search CORS for more):

1 Like