Foros del Web » Programando para Internet » Javascript » Frameworks JS »

notacion json

Estas en el tema de notacion json en el foro de Frameworks JS en Foros del Web. Holaa!! queria saber como tomar los checkbox que fueron checkeados y ponerlos en una variable json o formato json para ser enviado por ajax. esta ...
  #1 (permalink)  
Antiguo 18/06/2011, 13:44
Avatar de juan_14nob  
Fecha de Ingreso: abril-2010
Mensajes: 552
Antigüedad: 14 años
Puntos: 6
notacion json

Holaa!! queria saber como tomar los checkbox que fueron checkeados y ponerlos en una variable json o formato json para ser enviado por ajax.

esta funcion lo que hace es tomar el value de los checkbox que fueron seleccionados
Código Javascript:
Ver original
  1. function tomar_seleccionado(arg1){
  2.  
  3.     for (var i=0;i < document.forms['agenda_telefonica'].length;i++){
  4.         var elemento = document.forms[0].elements[i];
  5.        
  6.         if(elemento.checked){
  7.  
  8.             var vector = new Array();
  9.            
  10.             var el_check = parseInt(elemento.value);
  11.             alert(el_check);
  12.         }    
  13.     }
  14. }
pero no se como hacer que los seleccionados se vallan metiendo dentro del array "vector"



Y este es el formulario HTML
Código HTML:
Ver original
  1. <form id="agenda_telefonica">
  2.     <table border='1' cellspacing='0' cellpadding='0' class="obj_tabla">
  3.         <tr>
  4.             <td width="3%"><b><center>#</center></b></td>
  5.             <td width="36%"><b><center>Nombre</center></b></td>
  6.             <td width="36%"><b><center>Email</center></b></td>
  7.             <td width="22%"><b>Telefono</b></td>
  8.             <td width="3%"><b><input type="checkbox" name="check" onclick="pasar(this)"></b></td>
  9.         </tr>  
  10.  
  11.         <tr>
  12.             <td>1</td>
  13.             <td>Abuela mariana</td>
  14.             <td>---</td>
  15.             <td>4514673</td>
  16.             <td><input type='checkbox' id='q' name='checkbox' value='31'></td>
  17.         </tr>
  18.         <tr>
  19.             <td>2</td>
  20.             <td>awdawd</td>
  21.             <td>awdawdaw</td>
  22.             <td>232323</td>
  23.             <td><input type='checkbox' id='q' name='checkbox' value='20'></td>
  24.         </tr>
  25.         <tr>
  26.             <td>3</td>
  27.             <td>awdawdad</td>
  28.             <td>wdadaw</td>
  29.             <td>2323</td>
  30.             <td><input type='checkbox' id='q' name='checkbox' value='10'></td>
  31.         </tr>
  32.         <tr>
  33.             <td>4</td>
  34.             <td>dawdad</td>
  35.             <td>dwadawd</td>
  36.             <td>323</td>
  37.             <td><input type='checkbox' id='q' name='checkbox' value='33'></td>
  38.         </tr>
  39.         <tr>
  40.             <td>5</td>
  41.             <td>dawdad</td>
  42.             <td>dawdawd</td>
  43.             <td>2323</td>
  44.             <td><input type='checkbox' id='q' name='checkbox' value='12'></td>
  45.         </tr>
  46.         <tr>
  47.             <td>6</td>
  48.             <td>dawdada</td>
  49.             <td>awdadaw</td>
  50.             <td>44</td>
  51.             <td><input type='checkbox' id='q' name='checkbox' value='19'></td>
  52.     </table>
  53.  
  54. </form>



Saludos y graciass!!!!!

Etiquetas: ajax, json
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:09.