[jQuery] Re: processing json object

2008-05-06 Thread Nicola Rizzo

ops!
for(var i = 0; i < records.length; i++){...

On Tue, May 6, 2008 at 5:16 AM, JP <[EMAIL PROTECTED]> wrote:
>
>  thanks !
>
>  I only had to add:
>   ...   i < records.length; ...
>
>
>  On May 4, 2:14 pm, "Nicola Rizzo" <[EMAIL PROTECTED]> wrote:
>  > success: function(json, status){
>  > var records = json.Records;
>  > var str = "";
>  > if(records){
>  > for(var i = 0; i < records; records++){
>  > for(var j in records[i]){
>  > str += j + " --> " + records[i][j] + "\n";
>  > }
>  > }
>  > window.alert(str);
>  > }
>  >
>  > }
>  >
>  > hth,
>  > Nicola
>  >
>
>
> > On Sun, May 4, 2008 at 8:02 PM, JP <[EMAIL PROTECTED]> wrote:
>  >
>  > >  how can I process values from json object without having to use
>  > >  indivual reference names?
>  >
>  > >  using json:
>  >
>  > >  ( {"Records": [ {"firstname":"Nancy","lastname":"Davolio"} ],
>  > >  "RecordCount":"1" } )
>  >
>  > >  instead of  :
>  >
>  > >  $.ajax({ ..
>  >
>  > > success: function(json, status) {
>  > >   if(json.Records){alert("Records="+json.Records[0].firstname );}
>  > >  ...
>  >
>  > >  is there a way to numerically reference values --something like :
>  >
>  > >  $.ajax({ ..
>  >
>  > > success: function(json, status) {
>  > >   if(json.Records){alert("Records="+json.Records[0].0);}
>  > >  ...
>  >
>  > >  only it should work :)
>  >
>  > >  thanks in advance
>


[jQuery] Re: processing json object

2008-05-05 Thread JP

thanks !

I only had to add:
 ...   i < records.length; ...

On May 4, 2:14 pm, "Nicola Rizzo" <[EMAIL PROTECTED]> wrote:
> success: function(json, status){
> var records = json.Records;
> var str = "";
> if(records){
> for(var i = 0; i < records; records++){
> for(var j in records[i]){
> str += j + " --> " + records[i][j] + "\n";
> }
> }
> window.alert(str);
> }
>
> }
>
> hth,
> Nicola
>
> On Sun, May 4, 2008 at 8:02 PM, JP <[EMAIL PROTECTED]> wrote:
>
> >  how can I process values from json object without having to use
> >  indivual reference names?
>
> >  using json:
>
> >  ( {"Records": [ {"firstname":"Nancy","lastname":"Davolio"} ],
> >  "RecordCount":"1" } )
>
> >  instead of  :
>
> >  $.ajax({ ..
>
> > success: function(json, status) {
> >   if(json.Records){alert("Records="+json.Records[0].firstname );}
> >  ...
>
> >  is there a way to numerically reference values --something like :
>
> >  $.ajax({ ..
>
> > success: function(json, status) {
> >   if(json.Records){alert("Records="+json.Records[0].0);}
> >  ...
>
> >  only it should work :)
>
> >  thanks in advance


[jQuery] Re: processing json object

2008-05-04 Thread Nicola Rizzo

success: function(json, status){
var records = json.Records;
var str = "";
if(records){
for(var i = 0; i < records; records++){
for(var j in records[i]){
str += j + " --> " + records[i][j] + "\n";
}
}
window.alert(str);
}
}

hth,
Nicola
On Sun, May 4, 2008 at 8:02 PM, JP <[EMAIL PROTECTED]> wrote:
>
>  how can I process values from json object without having to use
>  indivual reference names?
>
>  using json:
>
>  ( {"Records": [ {"firstname":"Nancy","lastname":"Davolio"} ],
>  "RecordCount":"1" } )
>
>  instead of  :
>
>  $.ajax({ ..
>
> success: function(json, status) {
>   if(json.Records){alert("Records="+json.Records[0].firstname );}
>  ...
>
>  is there a way to numerically reference values --something like :
>
>  $.ajax({ ..
>
> success: function(json, status) {
>   if(json.Records){alert("Records="+json.Records[0].0);}
>  ...
>
>  only it should work :)
>
>  thanks in advance
>