Help needed | Wikipedia Viewer [solved]

I could not figure out why my application is not giving the search results. But when i debug using the chrome developer tools it is getting the blob of data from mediawiki api and creating the search results and finally getting back to the home page.

Any help/suggestions would be highly appreciated.

Your search button is an anchor tag <a>, which will send the browser to a new location by default. I wouldn’t suggest using anchor tags in this way, but since we’re here, you can override the default behavior. Every event handler gets passed an event object, and that object has a method, preventDefault, which will prevent the default behavior of the event. Who would have guessed, am I right?

So, simplest fix:

search.on('click', function(e){
    // Do other stuff

There’s a similar problem when it comes to the <form> tag, which responds to pressing the enter key by submitting data. You could fix this is much the same way as the anchor tag, but I think it’d be better if you just replaced the <form> with a <div> for now.

Thanks a lot. It worked.