I can’ figure how to do that.
I have several hidden fields
<input type="hidden" id="order_1" name="order_1" value="1">
<input type="hidden" id="order_2" name="order_2" value="2">
<input type="hidden" id="order_3" name="order_3" value="3">
<input type="hidden" name="ids[]" value="1">
<input type="hidden" name="ids[]" value="2">
<input type="hidden" name="ids[]" value="3">
etc..
The idea is to pass the data via ajax like this.
var id = $('input').attr('name')
$.post('http://foobar.com/ajax.php', {ids : ids, order: order}, function(data){
});
What I can’t figure out is how to collect the data.
On the other side in ajax.php I wan’t to get the values like this
echo $_POST['order_1'];
echo $_POST['order_2'];
......
etc
I think your looking for
.serialize. See the api.Try something like this:
Bear in mind the selector I used for the hidden inputs can be changed by you to be more specific, perhaps by using the form id.