I have a form which have five buttons and several checkboxes holding different values.
<form action="" method="post" id="create-user">
<button type="button" name="new-user">New</button>
<button type="button" name="activate-user">Activate</button>
<button type="button" name="block-user">Block</button>
<button type="button" name="unblock-user">Unblock</button>
<button type="button" name="delete-user">Delete</button>
<input type="checkbox" value="1>" name="userId[]" />
<input type="checkbox" value="2>" name="userId[]" />
<input type="checkbox" value="3>" name="userId[]" />
<input type="checkbox" value="4>" name="userId[]" />
<input type="checkbox" value="5>" name="userId[]" />
</form>
now based on JavaScript event like onclick, i would like to perform different action for different buttons, for example.
a) <button type="button" name="new-user">New</button>
When User click this button it should redirect to following url.
'index.php?users&option=create'.
b) <button type="button" name="activate-user">Activate</button>
this button is used for Ajax, it should fetch the selected checkbox value in an array i.e
userId[], and send the data tomanage-users.phpand update form after receiving the response. and the rest three buttons Block, Unblock and Delete follows the same procedure as this.
And all this should be done using JQuery, as i am still a novice in JS/JQuery, i would appreicate if someone could guide me with creating JQuery function.
thanks.