showing results for - "how to make a json call to an url"
Luna
12 Nov 2020
1function getJSONP(url, success) {
2
3    var ud = '_' + +new Date,
4        script = document.createElement('script'),
5        head = document.getElementsByTagName('head')[0] 
6               || document.documentElement;
7
8    window[ud] = function(data) {
9        head.removeChild(script);
10        success && success(data);
11    };
12
13    script.src = url.replace('callback=?', 'callback=' + ud);
14    head.appendChild(script);
15
16}
17
18getJSONP('http://soundcloud.com/oembed?url=http%3A//soundcloud.com/forss/flickermood&format=js&callback=?', function(data){
19    console.log(data);
20});  
21