I am appending multiple input boxes and successfully posting one input array to the mysql as here it is.
$('<p><input type="text" class="name" name="task" ></p>').appendTo($('#add_here'));
function addmem(id, text, number) {
$('input.name').each(function() {
// var te=$('input.task').val();
$.post(
'sendchat2.php',
{ option: 'add_mem', id: id , text: $(this).val() },
function(data) {
alert(data);
});
});
}
But now I need to post two input arrays at the same time. One input is customer name and another is his mobile number. I tried the below, but its not working correctly. Please help or suggest any alternative approach.
$('<p><input type="text" class="name" ><input type="text" class="number" name="task" ></p>').appendTo($('#add_here'));
function addmem(id, text, number) {
$('input.name').each(function() {
$('input.number').each(function() {
$.post(
'sendchat2.php',
{ option: 'add_mem', id: id, text: $(this).val(), number: $(this).val()},
function(data) {
alert(data);
}
);
});
});
}