Random Quote Generator: Issues Putting a Function within a Function

After a great deal of work, I’ve gotten my page to display a random Bible verse every time it is loaded. However, if I try wrapping the code in another function and calling it when the document is ready and/or on a button click, it doesn’t work at all. Can someone help? My codepen is here: http://codepen.io/csinclair/pen/YpBXXB

I don’t see your code for the wrapping function or the button click - can you put it so we can see what’s wrong?

I’m not really sure what you’re asking, but I forked your pen and got it working wrapped in the $(document).ready(function(){..})

Okay, so it works now. Thank you! (I was trying to wrap the whole thing, reather than just the bit with the AJAX.)

1 Like