I have a function in JavaScript that sends requests with the contents of the lines of a textarea
, is a looping that runs through an array and sends the requests with the data of these indexes of the array, the problem is that I need to create 1 more array with the contents of another textarea
and send simultaneously with the array of the first textarea
, in case:
<script>
function enviar(){
var bin = $("#bin_id").val();
var linhaenviar = bin.split("\n");
var cor = coloracao.split("\n"); //esse e o textarea do qual quero criar o array
var index = 0;
linhaenviar.forEach(function(value){
setTimeout(
function(){
$.ajax({
url: 'bancodedados.php',
type: 'POST',
dataType: 'json',
data: 'nome=' + value + 'cor=' +arraycor,
success: resultado
})
}, 10 * index);
index = index + 0;
})
}
</script>