It sent through AJAX values according to the checkboxes that a user selects to another page2 that receives them, and processes them to a BD, the problem is that I have a cycle each with jquery for the sending of the value that the user selected and if the user selects 3 ckeck the page2 is called 3 times to send the value of the check, every time that the page is called2 I draw an HTML table to place the values that correspond to the value of the check that was selected, How can I keep the values which are drawn in the html table of each call to page2? since if 3 checkboxes are selected the table is drawn once data appears and disappears, then the second time data appears and disappears, and finally the third time data appears and the data of the latter is displayed, what I require is that they appear the 3 tables
$("#btnEnviar").click(function () {
var selected = '';
var varValorCheck = '';
$("#form1 input[type=checkbox]").each(function () {
if (this.checked) {
selected += $(this).val() + ', ';
varValorCheck = $(this).val()
//alert(varValorCheck);
EnviarReporte(varValorCheck,selected);
}
});
if (selected == '')
alert('Debes seleccionar al menos una opción.');
return false;
});
function EnviarReporte(varValorCheck, varAcumulador) {
var facturaSeleccionada = varValorCheck
var acumuladorFact = varAcumulador
var cargando = $("#muestraSeccion").html("<center><img src='../Images/cargando1.gif' height='50px' width='50px'/><br/>Un momento por favor...<center>");
$.ajax({
type: 'POST',
url: 'guardarEnvio',
data: {
"facturaEnvio": facturaSeleccionada,
"acumuladorFactura": acumuladorFact
},
success: function(resultado) {
$("#muestraSeccion").hide().html(resultado).fadeIn("fast");
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
if (jqXHR.status === 0) {
alert('Not connect: Verify Network.=(');
} else if (jqXHR.status == 404) {
alert('Requested page not found [404].');
} else if (jqXHR.status == 500) {
alert('Error Interno del Servidor [500].');
} else if (textStatus === 'parsererror') {
alert('Requested JSON parse failed.');
} else if (textStatus === 'timeout') {
alert('Time out error.');
} else if (textStatus === 'abort') {
alert('Ajax request aborted.');
} else {
alert('Uncaught Error: ' + jqXHR.responseText);
}
}
});
}
@Code
PageData("Title") = "Escriba el título aquí"
Dim db = Database.Open("empresaFactura")
Dim factura = Request.Form("facturaEnvio")
Dim acumulador = Request.Form("acumuladorFactura")
Dim fecha = DateTime.Now().ToString("yyyy-MM-dd hh:mm:ss")
Dim verFactura As New funciones()
Dim resgistrosFactura = verFactura.DatosFacturaEnvio(factura)
Dim cuerpoCorreo As String
cuerpoCorreo = "<table style='border-color: #666;margin: 0 auto;' cellpadding='10' >" & _
"<tr style='background: #eee;'><thead> <td><strong>Factura</strong></td> <td><strong>Fecha<strong></td> </thead></tr>"
For Each item2 In resgistrosFactura
cuerpoCorreo += "<tr> <td>" & item2.nombre & "</td> <td>" & item2.ap & "</td> <td>" & item2.am & "</td> </tr>"
Next
cuerpoCorreo += "</table>"
Response.Write(cuerpoCorreo)
End Code