The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Changing a variable outside of a function

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #167816

    Hi guys

    I’m using a jQuery powered photo wall plugin, this one to be precise:

    I’m wanting to have a dropdown menu that allows users to change the current gallery.

    I’ve modified the code to the following but its not working as I’m having to set the currentURL varaible outside of the function.

    Can anyone let me know how to change the value of currentURL from inside the function?

    Or just a better way of doing this?


    My code (added a hypen to this URL to prevent the embed as it was showing blank)



    The codepen will be blank because there is no content.

    As I understand it, you have a catalog of images and you want to display some of them based on a selection from a <select> box…is that correct?

    Or did you really mean “dropdown menu” which is something completely different?

    So, assuming the former, which seems more likely, do you images have various tags/classes/whatever applied that JS/JQ could sort through?

    If you already have gallery pages set up, then I’m guessing some sort of AJAX injection is required.


    Hi Paulie

    Thanks for posting.

    Yeah I am referring to a <select>, sorry I always incorrectly call these drop downs.

    Well the plugin handles bringing in the images I just need to change the URL that it points to when the user makes a selection in the select box.

    I actually also asked this question on Stack Over Flow and someone has kindly replied. I think their answer will work. I was changing the variable but not refreshing the AJAX call.

    Their solution is here, if you can add anything to this I’d like to know.

    Thanks again.



    Thanks Shane I will mate.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.