- I have an unknown amount of clickable
buttons. (generated) - Every button is connected to
multiple values that should be sent
through the Ajax call.
I found this to start with:
$.ajax({
type: "POST",
url: "some.php",
data: parameters,
success: function(msg){
alert("nothing");
}
});
data contains parameters as far as I know. My parameters are different depending on what button that is clicked.
My guess is that I could use this somewhere? But what if I need to send 3 values?
<input type="button" id="unique-1"> <!-- With values 'test', 3 and 5 -->
<input type="button" id="unique-2"> <!-- With values 'doh2', 8 and 6 -->
I use PHP if you need that info.
Thanks!
Check out this fiddle. The button will find the form that it needs to submit, serialize the data, and alert that string. You would just need to then use that string as the parameter for the data option of the ajax call.