Wikipedia Viewer Project Completed But One Problem!

The project is completed, I think, to the requirements of FCC. But the app doesn’t seem to do anything when I enter gibberish texts in the input. I did added a fail() function to the getJSON but that doesn’t seem to work. Also, don’t mind the looks and responsiveness of the page :smiley: Didn’t work fully on that. But I love to get a feedback on the functionality of my code. Thanks :slight_smile:

Link: Codepen

POST-NOTE: I did an if-else condition where if non-meaningful texts were entered it would check if fetched json is empty. Is that enough?

For your validation, add this after line 27

var json = JSON.parse(rawJson);
      if (!json[1].length) alert("No Wiki data found!"); // add this

The colours are a bit “trippy” but if that’s what you were going for, I can’t complain.
Good job :+1:

Note: the .fail is for the API call failing.

1 Like

Thank you! Check my post-note above. I did an if-else check for empty json. Same thing right?

Awesome! But I’d try to limit the number of results too. Right now small popup says I have to choose anything between 5-10 but entering 100 still works.


@J_RO You’re just trying to break it! :stuck_out_tongue:

yes, that’s right!!! I think I should put a limit on it through JS/jQuery! Will work on it by checking length of the input

but it works, right???

I believe so, yes. :rofl::rofl::rofl::rofl::rofl:

1 Like

Haha guilty! If the only comments we have is minor stuff like this he did good though!

Now, I have put in an if-else so it alerts if user enters wrong numbers!!! Now I feel app is completed. Please see xD

Hey, I did the if-else check on the input number. Now is it ok?

1 Like

Good job!

1 Like

Thanks a lot!!! Now I’ll work on a close button to close all the searched articles :blush:

I forgot one important question. The hover on my articles pushes my text to the right due to the border created. I don’t know to work around that(to no affect the text). I did try a margin-left -ve but that creates bad transition

Maybe you can add a transparent border with the same width in the normal state and only have it transition the color on hover? Just guessing here, haven’t looked at your code :slight_smile:

1 Like

but there’s already a border of 1px in the normal state. :thinking:

Ok, I did make it work by using outline and transparent border-left in normal state. :slight_smile:

1 Like