With the help of StackOverflow over the last few months I have built the skeleton of my first website.I have a massive Jquery JSON function that pulls data from reddit based on the URL of the subreddit. I also have 3

<div>

's (Dayz, BuildaPCSales and Bronies as a test).

When I click on any of those bars I would like my Javascript function to dynamically load data from

'https://www.reddit.com/r/' + encodeURIComponent(subreddit) + '.json'

- with (subreddit) being the val() text of the

<div>

. In this example, if I click on "Dayz" I want the reddit to load data from

r/dayz.json

without having to manually type the URL into the code.

Here is my javascript function. It currently works, successfully, for any reddit that I manually type the URL for.