Hello everyone !
Why I am here is, to know how can I fetch data from Wikipedia
I am having an input.
User types something in it.
When the submit button is pressed, can I get the description of the inputted text from Wikipedia??
Is it possible itself ??
Thanks everyone !!!
1 Like
Hi! It’s not question to Wix, its question if you can set up Wikipedia API - https://www.mediawiki.org/wiki/API:Main_page
If its possible to get data with this API, you can get this data with Corvid.
Thanks for your answer mate !!
I have read this documentation already but some of the functions are not available in Corvid. That’s why I asked
This was the code I got after searching
$.ajax({
url: 'http://en.wikipedia.org/w/api.php',
data: { action: 'query', list: 'search', srsearch: $("input[name=Wikipedia]").val(), format: 'json' },
dataType: 'jsonp',
success: processResult
});
function processResult(apiResult){
for (var i = 0; i < apiResult.query.search.length; i++){
$('#display-result').append('<p>'+apiResult.query.search[i].title+'</p>');
}
}
You can’t just copypaste code which is (i guess) jquery code. You need to check https://www.wix.com/corvid/reference/wix-fetch/fetch article, understand which rest endpoints you want to consume, understand which response you expect and write Corvid code - which is javascript, but it has some differences.
I can’t provide you result of this process. If you met any issues during this process - you can ask here on forum, but don’t expect ready-to-go solution, it doesnt exist (yet).
Thanks!
I knew it is not Corvid (Javascript)…
I just want to know if I can do it with Corvid …
Thanks for your answers !
If anyone know any documentation or examples please post