I am stuck at wikipedia viewer ? Need help

I am stuck at wikipedia viewer ? Need help
0

#1

All is fine according to me but output shows and disappears in less than second.Here is my link: https://codepen.io/alihashir4799/pen/GvEXWK?editors=1011


#2

A basic debugging step would be to output the AJAX data to the console. When I did that there was no data getting back from the AJAX call, nothing.

When I get rid of the line async:false, it works fine:

    $.ajax({
      type:"GET",
      url:"https://en.wikipedia.org/w/api.php?action=opensearch&search=" + searchItem + "&format=json&callback=?",
      dataType:"json",
      success: function(data){
        console.log(data);
        // etc ...

#3

Forms refresh the page by default when you submit. You need to add a parameter in the click handler (usually named e or event), then add e.preventDefault() in the function body.

$('#search').click(function(e) {
  e.preventDefault();
  // rest of the code...
});

#5

Thank you for great information about forms.Program works now!.