dom - Form fields added via AJAX fail to load into the $_POST array -
i've got plain , simple html form allows people order brochures. form first loads looking little this:
<script type="text/javascript"> var tablerown = 1; </script> <form id="order" name="order" method="post" action="includes/ordercheck.php"> <input id="name" type="text" name="name" width="100" /> <table id="orderingtable"> <tr class="lastrow"> <td><div id="itemgroupdiv1"> <input type="text" class="disabled" name="itemgroup1" id="itemgroup1" /> </div></td> <td><div id="itemcodediv1"> <input type="text" name="itemcode1" id="itemcode1" class="disabled" /> </div></td> <td><div id="itemcodeversiondiv1"> <input type="text" class="disabledsmall" id="itemcodeversion1" name="itemcodeversion1" /> </div></td> </tr> </table> <input type="submit" name="submit" id="submit"/> </form>
then when user wants add new line table can click button fires following javascript function grab new table code via ajax , insert it.
function createitemline() { tablerown++; $('tr.lastrow').attr('class', ''); $('#orderingtable').append('<tr class="lastrow"></tr>'); $.ajax({ url: "/orderingtable.php?rnumber=" + tablerown, cache: false, success: function(html){ $("tr.lastrow").append(html); alert('loaded'); } }); }
the ajax function runs off php script creates next line, rolling ids , names etc +1 number.
<td><div id="itemgroupdiv2"> <input type="text" class="disabled" name="itemgroup2" id="itemgroup2" /> </div></td> <td><div id="itemcodediv2"> <input type="text" name="itemcode2" id="itemcode2" class="disabled" /> </div></td> <td><div id="itemcodeversiondiv2"> <input type="text" class="disabledsmall" id="itemcodeversion2" name="itemcodeversion2" /> </div></td>
so far, nothing suprising? should pretty straight forward...
the problem when add new lines (in firefox , chrome) new lines ignored form submission process, , never passed through $_post array.
is known problem? i've not come across before...
thanks pointers, h
use jquery.trim(data)
not pretty sure because can affect content of data. or see this one may u
Comments
Post a Comment