jmares79 ha scritto:
> Hi!! I'm using the $.post method, and I want to send an array of data.
> The docs says that only a map or a string is aceppted.
> Is there a way to send an array with some trick?
> Thanks!!!
>   
<input type="text" name="customarray['name']" value="Giovanni" 
class="myformdata" />
<input type="text" name="customarray['surname']" value="Lenoci" 
class="myformdata" />
<input type="text" name="anormalvar" value="HelloWorld" 
class="myformdata" />

data = $('.myformdata').serialize(); // 
customarray%5Bname%5D=Giovanni&customarray%5Bsurname%5D=Lenoci&anormalvar=HelloWorld

$.post("test.php", data);


On test.php you should receive :

$_POST => array ( customarray => array (name => 'Giovanni', surname => 
'Lenoci'), normalvar='HelloWorld');

Rembember that if you have to submit an entire form via ajax there's the 
form plugin, that do what wrote above in auto (and permit ajax file 
upload via the iframe method).

Bye

-- 
gianiaz.net - web solutions
via piedo, 58 - 23020 tresivio (so) - italy
+39 347 7196482 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to