Wikipedia Viewer Help needed

Wikipedia Viewer Help needed
0.0 0


ok my issue is with getting my app to work. this is what i have so far but is it enough and now what am i supposed to do, because i know it is working (the request)but i have no clue how to implement it.


Instead of putting console.log(url) in your code in the success anonymous function, put console.log(info); so you can see what you are actually getting back. You are getting back an error message. The message gives a link to the api documentation which I suggest checking out to see how you should be calling the API.


ok but how will i link that to my html and how does it all fit together?It is working fine I just have no clue how to output the info.


Just had a quick look at your codepen and you are getting the following error message in the console

Uncaught ReferenceError: searchInput is not defined

This is because you have defined your URL (which includes your searchInput) before you defined searchInput. Re-ordering your code like so will fix that error.

$(document).ready(function() {
 $("#button").on("click", function () {
    var searchInput = $("#input").val;
    var url = "*&search=" +searchInput;
    url: url,
    success: function(info) {
      $("#output").html("<h1>"+info[1][i]+"</h2>" +
"<a href="+ info[3][i]+ "><p>"+info[2][i]+"</p></a>");

I also noticed that the url you posted is returning the data you need. You are missing a few important query parameters. If you would like to work it out yourself I suggest you read the Wikipedia API documentation to see what you’re missing. Or if you’d prefer I can show you a url you can use for the request