I am stuck Wikipedia viewer

I am stuck Wikipedia viewer
0.0 0

#1

Hi all,

I think the jquery part is correct. But the console report error message. I use atom .

Here is error message. I have ever never see this.:sweat_smile:

{error: {…}, servedby: “mw1344”}
error
:
{code: “nosearch”, info: “The “search” parameter must be set.”, *: “See https://en.wikipedia.org/w/api.php for API usa… notice of API deprecations and breaking changes.”}
servedby
:
“mw1344”
proto
:
Object

Here is jquery part

$(document).ready(function () {
    $('#search'). on('click', function () {
      var content = $('#content').val();
      var url = 'https://en.wikipedia.org/w/api.php?action=opensearch&search' + content + '&format=json&callback=?';
      $.ajax({
        url: url,
        type: 'GET',
        async: false,
        dataType: 'jsonp',
        success: function (data) {
          console.log(data);
       
        },
        error: function (errorMessage) {
          alert('Error');
        }
      });

    });

#2

You are missing = after the query string parameter named search.


#3

Thanks so much. I miss =. :sweat: