Hello, sorry if this is the billionth Random Quote Machine post. I’d love any feedback on mine at: http://codepen.io/peterjmartinson/pen/jrVPBj
One question I have, is that I have two sets of $.getJSON calls - the first populates the quote when the page first loads, the second does the same when the user presses the button. They’re identical calls, so I would love to make them into a function that gets called twice, so the code isn’t repeated. However, I can’t figure out how to do it, because the calls are asynchronous - my element variable gets set before the AJAX call is completed. The commented out part shows my attempt. Any advice would be greatly appreciated!