0

I am getting this error:

Uncaught SyntaxError: Unexpected token :

When making this call:

function TopDonorCheck() {
$.ajax({
    url: "http://coebot.tv/api/v1/vars/get/top-donor/supermcgamer",
    type: 'GET',
    contentType: 'application/json',
    dataType: 'jsonp',
    success: function (TopDonorData) {
        console.log(JSON.parse(TopDonorData));
        console.log(TopDonorData);
    }
});
}

The response is:

{"value":"TheRealLemon","description":"","lastModified":1431276238,"status":"ok"}

I can't figure out what is wrong. Can someone help me with this?

Shyam Bhimani
  • 1,310
  • 1
  • 22
  • 37

1 Answers1

0

You have dataType: 'jsonp' but your data isn't JSONP, it's plain JSON. Change your ajax call to dataType: 'json'. See the documentation of dataType at http://api.jquery.com/jquery.ajax/

John Wiseman
  • 3,081
  • 1
  • 22
  • 31