javascript - Send data from large form by AJAX -


i have form 30 field: 3 field 10 times repeated. code:

<form id="artikelform" method="post" name="controleartikelen" action=""> <table id="controle">     <tr><th>maakartikel</th><th>aantal</th><th>leverdatum</th></tr>     {for $i=1 10}         <tr>             <td><input type="text" name="artikel" class="artinput"/></td>             <td><input type="text" name="aantal" class="aantalinput"/>&nbsp;x</td>             <td><input type="text" name="datum" class="dateinput"/></td>         </tr>     {/for} </table> <input type="button" onclick="javascript:startcontrole();" value="controleer"/> </form> 

i want send form-values php script ajax (post-method). tried send $.param($("#artikelform").serializearray()); ajax post-data result of function not usable (just lot of variables in sort of get-format). best way use form in combination ajax? maybe way of using serializearray()?

edit:

this code ajax-request:

$.ajax({             url: 'myscript.php',             cache: false,             data: formdata,             type: "post"         }).done(function(data){             $("#resultwrapper").html(data);         }) 

either:

1) use php function json_decode() map json encoded data structure php array, or

2) don't serialize payload name variables php arrays thus:

    <tr>         <td><input type="text" name="artikel[]" class="artinput"/></td>         <td><input type="text" name="aantal[]" class="aantalinput"/>&nbsp;x</td>         <td><input type="text" name="datum[]" class="dateinput"/></td>     </tr> 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -