Quote Generator AJAX & API issues - Vanilla JS


I’m attempting to create a random quote generator using only vanilla JS and this api


I’m having a hard time wrapping my head about a vanilla JS api call and AJAX. I’ve successfully made a quote generator with jQuery, but I can’t seem to get the vanilla js AJAX call to work, does anyone have any resources or examples of an AJAX call in vanilla JS?

My code is here if anyone is interested.

The problem you will run into when you use the forismatic API, is that you must use jsonp format. It is much more complicated to implement this method if you want to use XMLHttpRequest. This complexity is why JQuery’s methods are so handy. I would recommend learning about fetch which is Vanilla JavaScript that can be used with modern browsers.

You can also take a look at an article written about a custom function to work with JSONP format.