Wikipedia Viewer: Search Entries

Wikipedia Viewer: Search Entries
0.0 0

#1

Hello,

Im currently working on the Wikipedia viewer project, and I have encountered a problem.

I have the api figured out and the html is properly showing the links, but once i enter a search, if i try to search a different word the links only show up for the first search. Unless I click one of the links of my first search, the search wont reset itself.

Is there any quick fix to this?

Also, is there a better approach to generating a random word then just randomly choosing one from an array I created?


#2

If you post a link to your project code, we can take a look.

How is the related to the Wikipedia project? If so, can you explain how you are trying to use a random word for this project?


#3

Here is the link to my project: https://codepen.io/stewmeista/pen/wyPNQR

The project requires us to create a button for a random search but I just found the link for that, so disregard that part.


#4

It is performing the search both on the first and second attempt. The issue is you are appending the results to the div with id=“container”, so the 2nd search results are farther down the page after the first results. To remedy this effect, you can simply put $(’#container’).html(’’) to clear out the existing results before the for loop begins.


#5

Ah, I should have noticed the links further down the page.

Thanks for the help!