I would like to send the values of dynamically generated input boxes to the php page. I got the below code which appends input box on click from another question and was wondering how could I be able to pass the values as an array to php page. can someone help me out?
<fieldset id="buildyourform">
<legend>Build your own form!</legend>
</fieldset>
<button class='sbn'>Add</button><!--this adds input boxes-->
<button class=submit">submit</button>a
$(document).ready(function() {
$(".sbn").click(function() {
var intId = $("#buildyourform div").length + 1;
var fieldWrapper = $("<div class='fieldwrapper' id='field' + intId + '>");
var fName = $("<input type='text' class='fieldname form-control xd'/>");
var removeButton = $("<input type='button' class='remove btn btn-primary' value='-' />");
removeButton.click(function() {
$(this).parent().remove();
});
fieldWrapper.append(fName);
fieldWrapper.append(removeButton);
$("#buildyourform").append(fieldWrapper);
});
$('.submit').click(function(){
$.ajax({
method:'POST',
url:'test.php',
data:{},
success:function(response){
//
}
});
});
});