Ver Mensaje Individual
  #7 (permalink)  
Antiguo 07/11/2013, 13:19
chiney92
 
Fecha de Ingreso: septiembre-2013
Mensajes: 13
Antigüedad: 11 años, 5 meses
Puntos: 1
Respuesta: Problemas con json

Gracias por responder, en cuanto a error no me arroja nada y en cuento a arrays asociativos lo he probado con esto y si funciona:

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>Documento sin título</title>
  5. </head>
  6.  
  7. var m = '{"nombre":"juan","edad":"15"}';
  8. var dato = JSON.parse(m);
  9. alert(m);
  10. alert(dato.edad);
  11. </body>
  12. </html>

como pueden ver no estoy creando objetos solo estoy creando una variable segun el valor se volvera String y en cuanto al tipo de dato que espera cuando le puse typeof() me boto que lo que devolvia el php es un string, pero cuando pongo el JSON.parse() de ahi en adelante el codigo es ignorado