Hi, I seem to be having a problem using the wikipedia api, it was returning data but I changed the query and now I’m getting an error: status 404 response error. I’ve put the the following query into my browser and I get a successful response:
https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=peter&srlimit=10&format=json
but my code returns failure, any suggestions where I am going wrong?
code:
getWikiArts() {
$.ajax({
url: 'http://en.wikipedia.org/w/api.php',
jsonp: 'jsonp',
dataType: 'jsonp',
data: {
action: 'query',
list: 'search',
srsearch: 'peter',
srlimit: '10',
format: 'json'
},
success: function(arts) {
console.log(" heelo", arts.query.search[0].title)
},
error: function (jqXHR, exception) {
console.log('error: status ' + jqXHR.status + ' response ' + exception);
}
});
}
Thanks for any help…