Update a SELECT menu onclick

Discussion in 'JavaScript' started by Weirfire, Jun 11, 2007.

  1. #1
    When someone clicks a button on my page I want the select menu to update with some new information without the page refreshing.

    Basically I'm using an iFrame to upload files to the server and I'd like to be able to update the select menu with the new files on the same page.

    I've done some work with DOM's before but not sure if this method would be the best solution.
     
    Weirfire, Jun 11, 2007 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    ajsa52, Jun 11, 2007 IP
  3. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #3
    I had a read through that whole page and while it has functions to extract info from form items on a page without refreshing it has nothing about adding new items to a select menu without refreshing the page.

    Thanks for the resource though. :)
     
    Weirfire, Jun 11, 2007 IP
  4. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #4
    The idea is to replace the select with a new select (including all "option" elements) obtained from your server via AJAX.
     
    ajsa52, Jun 11, 2007 IP
    Weirfire likes this.
  5. MtCowboy4Life

    MtCowboy4Life Peon

    Messages:
    242
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I would also recomend ajax. ajsa52, thanks for the comment.
     
    MtCowboy4Life, Jun 11, 2007 IP
  6. Mike H.

    Mike H. Peon

    Messages:
    219
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Code deleted.

    They come here looking for help and then they disappear.
     
    Mike H., Jun 11, 2007 IP
  7. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #7
    I presume you are talking about me since you've posted the same thing on 2 of my threads. The beauty of a forum is that you can leave a query or a programming problem and come back the next day to see what other people have suggested. It just so happens that Digital Point is one of the few unique forums where you can get a response within minutes of issuing the problem.

    I wouldn't say that anyone who is suggesting a solution should expect the thread starter to sit and wait on the replies therefor I don't understand why you have offered a solution and then removed it.

    I do in fact appreciate the time you took in offering your thoughts but I'm a little perplexed at why you've removed them.
     
    Weirfire, Jun 12, 2007 IP