Give help. Get help.

  • # June 18, 2009 at 12:50 pm

    I removed my other post, because it was too long…and have revised my question, to simplify things.

    Situation: I have a series of checkboxes on a page, and each time a box is clicked, the value gets amended an array, then take the content of that array and build a url which should be loaded using .load. If the box is unchecked, I would like that value removed from the array and url rebuild and new page loaded.

    Question 1: Once a box is clicked how can I store that value to an array?
    Question 2: How do I build the .load url with an array?

    Here is the code I have so far…which works (kinda)


    This only works for one checkbox at a time…as there is currently no array. Can someone explain how I can store a clicked value?

    I kinda think I need to do something more like…

    If a box is checked, see what other boxes are checked and then send the values of all the boxes that are checked.

    Then, when a box is unchecked, check what boxes are checked and then resend the values in a url. Thoughts?


    # June 21, 2009 at 4:27 am

    The way you got your code working is everytime they click on a checkbox it will post information to server and load

    From how you are explaining im not sure what the end product is supposed to do anyways to answer you question if you want to store all the checkboxs in an array it would be done like this


    From the example above the array will have ["something","somethingElse"]

    For second Question:

    Depends on what language you are using, python, perl, php, ruby ect? but the universal way is to send a long string


    This will send "something, somethingElse" to the sever

    ((php: $_POST == "something, somethingElse" ))

    Then you could split that string back into a array or defintion list (all depending on the language)

    # June 21, 2009 at 5:01 am
    $.post(‘/link/to/file/’, {data : checkData.join(‘, ‘)} );

    That is not the best way to send data to a php script.

    The most efficient way is to use a subscripted variable, this way the data will be accessible as an array in the php script.

    For example:

    $.post(‘/link/to/file/’, { ‘data[]’ : checkData });

    Now in php the posted data will be available as an array:


    # June 21, 2009 at 5:10 am

    Your probably right

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.