It uses the js native
XMLHttpRequest() constructor, but that’s actually a misnomer, because it can return formats other than XML. In this case, it returns a JSON string, which is then parsed using
JSON.parse() to turn it into a usable JSON object.
It uses the js native
@lionel-rowe is there a specific reason you chose XMLHttpRequest over Jquery? Does one have greater interactivity or more performance gains over the other?
This is awesome. I hope it helps out the future campers.
If the JS you’re writing is optimal, native JS should typically be slightly faster than using libraries, though the difference should be fairly negligable. What’s slightly more worth considering is the size of the library code itself, which slows down page load times (however, assuming you have a decent internet connection, this should still be barely noticeable).
Mainly, I just wanted to try writing something in pure JS, as up until this point I’d used jQuery for almost everything other than a couple of rudimentary React projects. I think this is worthwhile as a learner, as it allows you to get a bit more into the nuts and bolts of the language, even if you’d typically be using libraries and/or frameworks on top of that in a professional setting.
I’ve put the JS through Babel, but even then the code is completely failing to run in IE8. In the interests of striking a balance between keeping this thread alive and not derailing it, I’m starting a new thread about that here.
Awesome! Thanks for making it. I just finished my Random Quote Generator using your API and it was a breeze.
It’s pretty basic, but here it is: https://codepen.io/drecali/full/RgZzaN/
Thanks again @Jluboff!
Awesome, great work! I’m really happy that people are using the API and enjoying it! My aim was to make something easy to use as other API’s can be quite challenging to understand and use
Just wanted to say thanks for doing this. I just finished the Apis and Microservices section and was going through my old projects and noticed my random quote machine no longer worked. Apparently the api I was using went away! Anyway, this is great and the quotes are a lot more fun than the ones I was getting. Thanks again!
just found out my old project api was dead and i find this gem on google. thanks