Wikipedia Viewer: Search Entries


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?

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?

Here is the link to my project:

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

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.

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

Thanks for the help!