Passing repeating elements to $.post

Passing repeating elements to $.post

Hi there,

Im using $.post and have a lot of repeating elements I need to post like the cat elements in the example code below.

I was hoping that I could use a loop in some way to add the repeating elements rather than listing them one by one.

Any ideas would be appreciated.




$.post("save.php",{
       id:$('#id').val(),
       save:$('#submit').val(),
       name:$('#name').val(),
       image:$('#image').val(),
       newimage:$('#newimage').val(),
       measure:$('#measure').val(),
       cat0:$('#cat0').val(),
       cat1:$('#cat1').val(),
       cat2:$('#cat1').val(),
       cat3:$('#cat3').val()      
     } ,function(data) {....