function getInfo()
{
var URL="https://api-oauth2.mendeley.com/oauth/authorize?client_id=374&redirect_uri=https://localhost/api/mendeley/mendeley.php&response_type=code&scope=all&JSON=1";
$.ajax({
url: URL,
type: 'get',
dataType: "jsonp",
jsonpCallback: "https://192.168.2.210/api/mendeley/mendeley.php",
converters: {
'text json': true
},
success: function (data) {
console.log(data.content);
},
error: function(e) {
console.log(e);
}
});
}
when I call this function this gives me error
SyntaxError: syntax error
You have several problems.
From the jQuery documentation:
https://192.168.2.210/api/mendeley/mendeley.php
is not a valid JavaScript function name.If I visit
https://api-oauth2.mendeley.com/oauth/authorize?client_id=374&redirect_uri=https://localhost/api/mendeley/mendeley.php&response_type=code&scope=all&JSON=1
orhttps://api-oauth2.mendeley.com/oauth/authorize?client_id=374&redirect_uri=https://localhost/api/mendeley/mendeley.php&response_type=code&scope=all&JSON=1&callback=something
, I get an HTML document prompting me to log in.You need to hit a real JSONP endpoint to use JSONP.