Need help with Wikipedia API (ajax specifically)

I feel like I should be passing this, I’m not too sure why I keep getting the error alert. Can anyone help me with this?

First thing you should do is to print the error in the error block. Usually it will give you more context.

$.ajax(......
       error: function(err) {
            Console.log(“error “, err)
       }
.....)

I’m the console is better because if the response is a Jason object you can transverse (move around) in it where an alert box won’t let you do that.

My initial guess is you don’t have permission and may need to pass an api key, but try printing the error message and see what comes up.

I didn’t know you needed an api key for the challenge I was doing?

I commented the ajax function out and tried to print things out and it worked, so the problem is contained within that function. I’m just not too sure how to debug this thing.

When I tried to console log the error it didn’t actually log anything while when I use alert it works.

Sounds good. So the actual issue is the success block. You’re console.log the input. You want to use the data that is the parameter being sent into the success function. You will use that data to update your markup (html) or what ever else you want to do.