Wikipedia viewer weird problem

i call a function when user click "ENTER’ and also the search button.When pressing AJAX response is fine.
But When clicking the search button it shows an error in my AJAX call.kinda seems weird.
A link to my codepen

Look at lines 8…10:

  $('.btn').click(function() {
    $('#search_box').val('');
  });

When you click any button you clear the search box, so your getData function gets called with an empty query.

1 Like

Thank you for the help buddy