Help with Wikipedia API

Hi, can anyone tell me what’s wrong with my code? When I run the request there is no status code and only a gray dot (?)
The url works and I’m using the same request info I used on another Wikipedia API project that works with no problem. http://codepen.io/AlannaL/pen/rjVKJd?editors=1111

The grey dot is the li (list item ) in your ul ( in your HTML).

Otherwise everything works fine !

It returns an object for you? For me I get a gray dot in the developer tools (instead of green or clear) and it doesn’t return anything

yes, I have an object in the console, and the network indicates that the request is successful.

When you hit Ctrl + i, you have several tabs: elements (html), console, and network (and other tabs)

Okay, great, thanks a lot! I’m glad to hear that it works! But still doesn’t work for me, very strange!

Could you take a sreenshot of what you have?

Aghhh, sorry, I’m having trouble saving it as a jpg. Clearly my computer is having much bigger issues :wink:

1 Like

Ok you see on the right you have the tab header that’s open…Well next to that you have the tab response, see that one.

Yeah, it’s completely empty! No response

Ok indeed, it does print an object in the console but the response indicates “failure to load data…” I don’t know!

What’s happening is that your page refreshes on each button click. For whatever reason, that is the default behavior of type="submit".

You can prevent this default behavior with the aptly named .preventDefault(). This is an event object method:

Alternately, you can change the button’s type to button:

<form class="text-center">
    <input type="textarea" id="query-box">
    <button class="btn btn-default" type="button">Submit</button>
</form>
2 Likes