json - How to fetch data from World Bank API (status is 200 But executing error block in jquery/ajax) -



json - How to fetch data from World Bank API (status is 200 But executing error block in jquery/ajax) -

i have below code fetch info in json format (http://api.worldbank.org/countries/all/indicators/palm_oil?date=2000m01:2020m12&per_page=1000&format=json)

actually, have specified datatype: jsonp, request happening status 200 , info coming in response success handler not invoked, invoking error block.

code below

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $.ajax({ contenttype: "application/json", datatype: 'jsonp', crossdomain: true, url: "http://api.worldbank.org/countries/all/indicators/palm_oil?date=2000m01:2020m12&per_page=1000&format=json", success: function() { console.log("success"); }, error: function() { console.log("error"); } }); }); </script>

using php function file_get_contents can accomplish this.

jquery json jsonp

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -