I want to use an API from a Wallpapers page but I run into restricted ajax domains. Investigate the error and it can be solved by using JQuery JSONP to take the information returned by the API. This is my request.
$.ajax({
url: endpoint,
type: 'GET',
dataType: 'jsonp',
data: { 'auth': apikey ,
'method':'search',
'term': keyword},
success: function(data){
console.log(data);
}
})
I also tried this way
$.getJSON(urlsearch+"?callback=?",function(result){
console.log(result);
})
It does not work in either of the two ways. I already checked that the API works correctly, This is the error that appears in firebug.
I read that maybe the server does not support JSONP or CORS and that a solution can be to create a PHP script that obtains the information and transfers it to javascript. But I'm not sure it's the best way to do it. Does anyone know of any solution?
Thanks in advance.