lundi 4 septembre 2017

Jquery: getting checkbox values and using them as URL parameters

I have a table with a checkbox column, each checkbox holds a unique value. Any and all of the checkboxes can be clicked.

When a button is clicked I want to concatenate those values to a URL string that I will then use in an ajax call.

Checkboxes

    <input type="checkbox" name="product[]" value="256">
    <input type="checkbox" name="product[]" value="317">
    <input type="checkbox" name="product[]" value="9985">
    <input type="checkbox" name="product[]" value="3751">

This is how I want the URL to end up:

        http://ift.tt/2iUcZWK value 1]&pid=[checkbox value 2]&pid=[checkbox value 3]

And so on.




Aucun commentaire:

Enregistrer un commentaire