Jquery HTTP POST -
i have jquery code appends field form. when submit form, fields appended not available php. there special have pick these fields up? here code:
$(document).ready(function() { window.unique = 0; //hides alert $("hide").click(function(){ $("#alert").hide(); }); $(document).on('click', '#toggle_header', function(){ window.unique++ $("#header_list").append("<li><input type='text' name='header_name" + unique + "' placeholder='name'><input type='text' name='header_value" + unique + "' placeholder='value'><a href='#' id='toggle_header_remove'><i class='icon-remove'></i></a></li>"); }); $(document).on('click', '#submit_query', function() { $.ajax({ url: 'index.php', type: 'post', data: $(this).serialize(), cache: false, datatype: 'json', success: function(data) { } }) }) }); <form method='post' action='index.php' id='main'> <input class="span5" id="appendedinputbuttons" type="text" name='url'> <button class='btn btn-inverse' id='submit_query'>get</button> </div> </br><a href='#' id='toggle_header'>add header<i class='icon-plus'></i></a> </br> <ol id='header_list'> </ol> </form>
a dump of post variable in php show values input in form except ones added jquery.
Comments
Post a Comment