javascript - Cannot get JSON data from URL -


apologies asking looks asked question cannot seem able data following url: http://www.strava.com/stream/segments/860503

i have tried following:

$(document).ready(function() {     $.ajax({         url: "http://www.strava.com/stream/segments/860503&callback=?",         datatype: "json",         success: function(data) {             $(document.body).append(data.latlng);         }     }); }); 

and:

$(document).ready(function() {     $.getjson("http://www.strava.com/stream/segments/860503&callback=?", function(data) {         $(document.body).append(data.latlng);     }); )}; 

but not having luck. have fiddled around 'json' , 'jsonp', adding '&callback=?' url other things suggested on so, no avail.

any appreciated.

that particular url not support jsonp. neither provide support cross origin resource sharing (cors) via access-control-allow-origin response header, therefore impossible directly call via ajax.

the requirement jsonp support server must output callback name function, passing json javascript object or array in argument function. example:

mycallback({ ...... }); 

a possible solution proxy ajax request through server side script on same domain, cross origin not problem server server requests.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -