Hello World!
I’m having a problem trying to get the extract of a wiki page. From my understanding, I cannot search titles and get extracts in one ajax call; also I cannot make two ajax calls on one button click (unless its coded after\inside the other). My attempt so far is thus:
-query list of titles, store them
-get page ids from query, store them
-call second ajax at the end of success to:
-query using pageids to get extracts, store them (trouble here!)
Here is a link to the CodePen so far: https://codepen.io/tylerOtj/pen/xPeoER
If I type in my browser https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&exintro=&exchars=60&pageids=18630637 I can view the ‘extracts’ content. This is what I want to access!
attempts:
Usually in firefox console, on an output of apiResults, I can expand Object -> Query -> Search-> and see the array for ex. all titles, Ajax call using above url outputs Object -> Query -> Pages with no relevant information. (1)
Separating common wiki api access url and data results in the same output (2)
Querying just using pageid to access all key:values results in same output (3)
Using combinations of generator, exintro: true, prop: extracts results in same output
If any of this is false, there’s a better way to go about it, I’m not using the API correctly, any other insight, or point in the right direction would be much appreciated! Thank you