ajax - could not get a json data from a link -


This is my script, I'm unable to get json data from the link, please hupper me, tell me what I am Anywhere wrong, u thank you in advance

  & lt; Script type = "text / javascript" & gt; Function getomethin () // wait for the HTML document {alerts ("l"); $ .getJSON ('http://developers-blog.org/resources/jquery-ajax/heroes-list.json', function (data) {console.log (data); alert (data); $ .ei (data) , Function (i, name) {$ ("div"). Enclosed (name + "");});}); } & Lt; / Script & gt;    

You must use a cross domain request.

"jsonp": Loaded in JSON block using JSONP. Additional "? Callback =?" Adds a crawling string parameter, "_ = [TIMESTAMP]" to disable the caching until the cache option is set to the right at the end of your url to specify the callback.

Try this type

  $ (document) .ready (function () {var url = "http://developers-blog.org/resources/jquery -ajax / heroes-list.json "; $ .getJSON (url +"? Callback =? ", Work (data) {console.log (data); alert (data); $ .eec (data, function (i, Name) {$ ("div"). Enclosed (name + "");}}}});    

Comments