[jQuery] Re: JSON , PHP, MySQL, and jQuery

2009-04-12 Thread Ricardo

Nope. There are no associative arrays in JS, and you can't have an
object without property names (that would be the case in your
example). The way he posted is correct, an array of objects.

On Apr 12, 2:23 am, Jean jnascime...@gmail.com wrote:
 [

  {'name': 'John', 'lastName': 'Doe','age':'25', 'height': '170',
  'weight': '120'},
  {'name': 'Jane', 'lastName': 'Doe','age':'26', 'height': '175',
  'weight': '121'},
  {'name': 'Jack', 'lastName': 'Doe','age':'27', 'height': '180',
  'weight': '122'} ]

 i think is

 {'
  [name': 'John', 'lastName': 'Doe','age':'25', 'height': '170',
  'weight': '120'],
 ['name': 'Jane', 'lastName': 'Doe','age':'26', 'height': '175',
  'weight': '121'],
  ['name': 'Jack', 'lastName': 'Doe','age':'27', 'height': '180',
  'weight': '122']}

 isnt?



 On Wed, Apr 8, 2009 at 11:21 PM, Renato Untalan phis...@gmail.com wrote:

  I'm having trouble parsing JSON in Javascript.

  The response i'm getting from PHP when making a request is:
  [
  {'name': 'John', 'lastName': 'Doe','age':'25', 'height': '170',
  'weight': '120'},
  {'name': 'Jane', 'lastName': 'Doe','age':'26', 'height': '175',
  'weight': '121'},
  {'name': 'Jack', 'lastName': 'Doe','age':'27', 'height': '180',
  'weight': '122'} ]

  How would I go about parsing this in Javascript?  Am I not encoding it
  correctly on the PHP Side?

  Here's my JAVASCRIPT:
         $.get(includes/functions_inside.php, {function : getAppList},
                 function(data, textStatus){
                         alert( data[0] );
                 }
         );

  Here's my PHP:

         $AppListQuery = $insideDB-customQuery($query);
         $rows = array();
         while($r = mysql_fetch_assoc($AppListQuery)) {
             $rows[] = $r;
         }
         print json_encode($rows);

  Thanks in advance!

 --
 []´s Jean a.k.a Suissa

 Tecnólogo em Análise de Sistemas - 
 UTF-PRwww.tudopg.com.brwww.tudocuritiba.com.brwww.tudocacascavel.com.brwww.tudofoz.com.brwww.tudopuava.com.br


[jQuery] Re: JSON , PHP, MySQL, and jQuery

2009-04-11 Thread Jean

[
 {'name': 'John', 'lastName': 'Doe','age':'25', 'height': '170',
 'weight': '120'},
 {'name': 'Jane', 'lastName': 'Doe','age':'26', 'height': '175',
 'weight': '121'},
 {'name': 'Jack', 'lastName': 'Doe','age':'27', 'height': '180',
 'weight': '122'} ]

i think is

{'
 [name': 'John', 'lastName': 'Doe','age':'25', 'height': '170',
 'weight': '120'],
['name': 'Jane', 'lastName': 'Doe','age':'26', 'height': '175',
 'weight': '121'],
 ['name': 'Jack', 'lastName': 'Doe','age':'27', 'height': '180',
 'weight': '122']}

isnt?

On Wed, Apr 8, 2009 at 11:21 PM, Renato Untalan phis...@gmail.com wrote:

 I'm having trouble parsing JSON in Javascript.

 The response i'm getting from PHP when making a request is:
 [
 {'name': 'John', 'lastName': 'Doe','age':'25', 'height': '170',
 'weight': '120'},
 {'name': 'Jane', 'lastName': 'Doe','age':'26', 'height': '175',
 'weight': '121'},
 {'name': 'Jack', 'lastName': 'Doe','age':'27', 'height': '180',
 'weight': '122'} ]

 How would I go about parsing this in Javascript?  Am I not encoding it
 correctly on the PHP Side?

 Here's my JAVASCRIPT:
        $.get(includes/functions_inside.php, {function : getAppList},
                function(data, textStatus){
                        alert( data[0] );
                }
        );

 Here's my PHP:

        $AppListQuery = $insideDB-customQuery($query);
        $rows = array();
        while($r = mysql_fetch_assoc($AppListQuery)) {
            $rows[] = $r;
        }
        print json_encode($rows);

 Thanks in advance!




-- 
[]´s Jean a.k.a Suissa

Tecnólogo em Análise de Sistemas - UTF-PR
www.tudopg.com.br
www.tudocuritiba.com.br
www.tudocacascavel.com.br
www.tudofoz.com.br
www.tudopuava.com.br


[jQuery] Re: JSON , PHP, MySQL, and jQuery

2009-04-09 Thread donb

$.get(includes/functions_inside.php, {function :
getAppList},
function(data, textStatus){
alert( data[0] );
},
  'json'
);

Specify the return data type as 'json'.

On Apr 8, 10:21 pm, Renato Untalan phis...@gmail.com wrote:
 I'm having trouble parsing JSON in Javascript.

 The response i'm getting from PHP when making a request is:
 [
 {'name': 'John', 'lastName': 'Doe','age':'25', 'height': '170',
 'weight': '120'},
 {'name': 'Jane', 'lastName': 'Doe','age':'26', 'height': '175',
 'weight': '121'},
 {'name': 'Jack', 'lastName': 'Doe','age':'27', 'height': '180',
 'weight': '122'} ]

 How would I go about parsing this in Javascript?  Am I not encoding it
 correctly on the PHP Side?

 Here's my JAVASCRIPT:
         $.get(includes/functions_inside.php, {function : getAppList},
                 function(data, textStatus){
                         alert( data[0] );
                 }
         );

 Here's my PHP:

         $AppListQuery = $insideDB-customQuery($query);
         $rows = array();
         while($r = mysql_fetch_assoc($AppListQuery)) {
             $rows[] = $r;
         }
         print json_encode($rows);

 Thanks in advance!


[jQuery] Re: JSON , PHP, MySQL, and jQuery

2009-04-09 Thread Chuck Harmston

Alternatively, you can use jQuery's $.getJSON() function, which
automatically parses the JSON data and returns if as a Javascript
object.

Chuck Harmston
http://chuckharmston.com

On Thursday, April 9, 2009, donb falconwatc...@comcast.net wrote:

         $.get(includes/functions_inside.php, {function :
 getAppList},
                 function(data, textStatus){
                         alert( data[0] );
                 },
               'json'
         );

 Specify the return data type as 'json'.

 On Apr 8, 10:21 pm, Renato Untalan phis...@gmail.com wrote:
 I'm having trouble parsing JSON in Javascript.

 The response i'm getting from PHP when making a request is:
 [
 {'name': 'John', 'lastName': 'Doe','age':'25', 'height': '170',
 'weight': '120'},
 {'name': 'Jane', 'lastName': 'Doe','age':'26', 'height': '175',
 'weight': '121'},
 {'name': 'Jack', 'lastName': 'Doe','age':'27', 'height': '180',
 'weight': '122'} ]

 How would I go about parsing this in Javascript?  Am I not encoding it
 correctly on the PHP Side?

 Here's my JAVASCRIPT:
         $.get(includes/functions_inside.php, {function : getAppList},
                 function(data, textStatus){
                         alert( data[0] );
                 }
         );

 Here's my PHP:

         $AppListQuery = $insideDB-customQuery($query);
         $rows = array();
         while($r = mysql_fetch_assoc($AppListQuery)) {
             $rows[] = $r;
         }
         print json_encode($rows);

 Thanks in advance!

-- 
Chuck Harmston
cpharms...@gmail.com
Cell: (612) 961-0690