Invalid label error with JSON request

I read a lot about it, and I just can't figure it out. This has nothing to do with the MY code, it is related to the feed or something, because if I change it to a Twitter feed, it will return an Object, which is ideal.

$.getJSON('http://rockbottom.nozzlmedia.com:8000/api/portland/?count=1&callback=?',function(json){ console.log(json) }); 

And I get the error "wrong label". Any ideas?

Besides the side notes, I also tried the AJAX method:

 $.ajax({ url: 'http://rockbottom.nozzlmedia.com:8000/api/portland/', dataType: 'jsonp', data: 'count=1', success: function(msg){ console.log(msg) } }); 

and both give the same exact error, and both work fine with the Flickr and Twitter examples, so this should be something to do with the feed, but I don’t have access to the feed, but I could ask them to fix it something their problem.

+4
source share
3 answers

Verify that the server side can correctly handle the JSONP request. See here for example.

Change The server does not seem to carry the returned JSON object with the name of the callback function. The server should return:

 callback( { json here } ) 

but not

 { json here } 
+5
source

This url looks like you are expecting you to receive a JSONP callback (from the callback=? Bit). This is probably the problem; it returns Javascript, not JSON (because it works JSONP). For more information on using JSONP services, see the $.ajax .

+2
source

The returned content has uninsulated double quotes in one of the lines. This is invalid JSON:

 ..."full_content":"just voted "with Mandy " on... 
0
source

Source: https://habr.com/ru/post/922464/


All Articles