I am trying to access data using getJSON function of jquery but not able to succeed.
This is my js file:
$(document).ready(function(){
  $("button").click(function(){
    $.getJSON( "https://www.bitstamp.net/api/eur_usd/", function( data ) {
    alert(data);
    });
  });
});
Can anyone help me in getting this work?
Will really appreciate.
try to have error message in ajax call
$(document).ready(function() {
        $("button").click(function() {
            $.getJSON("https://www.bitstamp.net/api/eur_usd/", function(data) {
                    alert(data);
                }
                .error(function(xhr) {
                    alert(xhr)
                })
            );
        });
    });
Note: Xhr.responseText will provide you the stack trace of error, it returns in the html format
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With