Save checkbox array in javascript variable and send it to php by GET

0

The button performs the function

<form name="mandararray">
<input  type="text" id="atencion" value="<? echo $atencion;?>"/>
<input  type="text"  id="cotiza">
//checkbox esta dentro de un while
<input type="checkbox" name="for2[]" value="<? echo $row["id"];?>">
//end while
<button type="submit" onClick="compra();">Orden de compra</button>
</form>

in the function the values are saved by means of id, but I can not save the data inside the array in the variable for2. what fails is to save the data of the checkbox in the variable for2

function compra(){
     //-------------------------------------------------// 
     var for2 = document.mandararray.elements[“for2[]”];
     //-------------------------------------------------// 
     var cotiza = $("#cotiza").val(); 
     var provid = $("#provid").val(); 
     var atencion = $("#atencion").val(); 
     var empresa = $("#empresa").val(); 
     VentanaCentrada('./pdf/documentos/ordendecompra_pdf.php?cotiza='+cotiza+'&for2='+for2+'&atencion='+atencion+'&empresa='+empresa+'&provi d='+provid,'Cotizacion','','1024','768','true'); 
    };  

the function sends the variables quoted, company etc. to an archival that generates a pdf with the values sent. but I can not get the array values for2 []

    
asked by Abraham Juarez 27.06.2017 в 22:22
source

0 answers