Ajax sends an array containing values that the user selects from a checkbox set in this way
$("#btnEnviarTelcel").click(function () {
var conjuntoFacturas=[];
$("#form1 input[type=checkbox]").each(function (i) {
if (this.checked) {
conjuntoFacturas[i]= $(this).val();
}
});
EnviarReporte(conjuntoFacturas);
if (selected == '')
alert('Debes seleccionar al menos una opción.');
return false;
});
function EnviarReporte(varValorCheck) {
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: {
"facturasEnvio": JSON.stringify(varValorCheck),
},
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 {
alert('Uncaught Error: ' + jqXHR.responseText);
}
}
});
}
later on the page "saveAnswer" I retrieve the array like this:
Dim grupoFacturas=Request.Form("facturasEnvio") Dim result = JsonConvert.DeserializeObject(grupoFacturas) Response.Write(result)
and it shows me the next result
but how can I get the values individually? since I would be doing an update for each value returned by the array