1

This is the link from which I want to get data:

http://xeuroasiantvx.api.channel.livestream.com/2.0/listplaylists.json?callback=listplaylists

Below is my code. Please tell me what I am doing wrong.

$.getJSON('http://xeuroasiantvx.api.channel.livestream.com/2.0/listplaylists.json?callback=listplaylists').then(function(data) {
    alert('Your Json result is: ' + data.result); //you can comment this, i used it to debug
    result.innerText = data.result; //display the result in an HTML element
}, function(status) { //error detection....
    alert('Something went wrong.');
});

i have also tried to use this Fiddle but not working.

naman
  • 52
  • 1
  • 10
  • 2
    Firstly, that URL returns JSON, not JSONP. Secondly because you're making a request to an external domain you will be blocked by the [Same Origin Policy](http://en.wikipedia.org/wiki/Same-origin_policy). See the question I marked as duplicate for more information about the issue and potential workarounds. – Rory McCrossan Nov 24 '15 at 07:49
  • What's happening now? Did you check for any console errors? – Guruprasad J Rao Nov 24 '15 at 07:49
  • there are no errors in console. response is empty – naman Nov 24 '15 at 07:54
  • 1
    you can try with ajax method. in ajax method type will be GET and datatype will be jsonp.See the sample code here:http://jsfiddle.net/nu3v07hu/ – Yasemin çidem Nov 24 '15 at 08:10
  • 2
    @Yaseminçidem thanks dude i have already figured out the problem actually i was using dataType: json to get data from external url but external url requires datatype: jsonp . now it's fixed :) – naman Nov 24 '15 at 08:18

0 Answers0