Passing Variable Sized Form
I have a form that is of variable size (length) that is populated from a MySQL db. There are 4 fields that make up the information used to create a button (id, button#, name and p
Solution 1:
Hope this helps:
$('form').submit(function() {
$.post("myfile.php", $(this).serialize(), function(response) {
console.log(response);
});
});
Solution 2:
What about something like this? http://jsfiddle.net/r0k3t/e6W3Z/ as you can see you can add any number of fields and they will all get dumped into qString.
$('#yourform').submit(function() {
var qString = "";
$('#yourform input[type=text]').each(function() {
qString += $(this).attr("id") + "=" + $(this).val() + "?";
});
console.log(qString);
returnfalse;
});
From you question is appears that you can grab the values of the button because you do that elsewhere. Once you are happy with the query string you can use .post as Joe Brown suggested.
Solution 3:
You can assign variable names, something like a00 to a99, b00 to b99 etc. that are being sent to the server in a POST request. Then simply on the server side check which values have been set and then treat the accordingly.
It's a bit crude, but it should work.
Post a Comment for "Passing Variable Sized Form"