[jQuery] $.post related question

[jQuery] $.post related question


Hello!
I'm new to jquery (and actually, js); I'm using it to cover some
customer's needs and I'm finding it pretty much straightforward
however I have a problem that I can solve by looking at docs.jquery or
at other tutorial/examples.
I'm basically using jquery to $.post stuff to a .php script.
Everything works fine for the most part. I do have a problem when it
comes to abstract it a bit.
I use the following code:
if( some_check_here ) {
$.post('page.php?rand='+Math.round(Math.random()*100000)+'',
{ action: "save", fieldset: fieldset, title: title }, function(data) {
$('fieldset#'+fieldset+' div.data').html(data);
refresh_data(fieldset);
});
}
(I'm hoping identation won't be a problem..)
With the above example everything works fine, I POST action="save",
fieldset="value of fieldset var", title="value of title var".
The problem is that I have many POST to do, and I can't always apply
the function above. For example in a portion of the page I let the
user to add an arbitrary number of fields (pretty much like gmail's
button letting you attach an arbitrary number of files to an email).
Therefore I have to use input fields named "arbitraryinput[]" to
accomplish the task.
So I'm trying to abstract this by .find()'ing input elements
with .attr(type) = "text". with .map() .get and .join I'm able to
produce a string similar to { fieldname: value, .... } (I know it
since I do alert() to check..) but when I use the given string in that
$.post line it won't work at all (no output from the .php page).
I'm pretty much sure there HAS to be a solution for this to work, but
I can't find it on my own (probably due to my ignorance in this
matter).. can anyone educate me, or point me to an helpful resource on
this issue? :)
Thanks in advance!