[jQuery] Re: Json help adding into Object

2009-02-24 Thread Mike Alsup
> I would like to use Objects better, because I would like to use the > little search code. When I try and run the program the error message I > get from FF is 'Error: abbrs[somevar] is undefined'. > The full script: > > $("#load_abbr_data").click(function() > { > var abbrs = {} > >         $.getJ

[jQuery] Re: Json help adding into Object

2009-02-24 Thread Michael
I would like to use Objects better, because I would like to use the little search code. When I try and run the program the error message I get from FF is 'Error: abbrs[somevar] is undefined'. The full script: $("#load_abbr_data").click(function() { var abbrs = {} $.getJSON("jsondata.php"

[jQuery] Re: Json help adding into Object

2009-02-24 Thread jQuery Lover
I recommend using arrays as well :) Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Tue, Feb 24, 2009 at 5:58 PM, Mike Alsup wrote: >> $.each(data.abbr_data, function(i,get_abbr_data) >> { >>

[jQuery] Re: Json help adding into Object

2009-02-24 Thread Mike Alsup
>                         $.each(data.abbr_data, function(i,get_abbr_data) >                         { >                                 var abbr = get_abbr_data.ABBR; >                                 var desc = get_abbr_data.DESCRIPTION; >                                 var lang =  get_abbr_data

[jQuery] Re: Json help adding into Object

2009-02-24 Thread jQuery Lover
As far as I can see you are overwriting your abbrs object. You must be getting the last value. You may find jQuery.extend utility usefull: http://docs.jquery.com/Utilities/jQuery.extend Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Mon, Feb 23, 2009 at 7:45 PM, Michae

[jQuery] Re: Json help adding into Object

2009-02-24 Thread Michael
Just giving this a little bump :)

[jQuery] Re: JSON Help?

2007-10-06 Thread sgrover
Thank you for the response. I'm looking into the various points. The brackets were an attempt to get the thing working. Normally that would just be the array block "[ . . . ]", and the inner objects. Shawn Michael Geary wrote: > That's not JSON code. > > * JSON doesn't use a () wrapper arou

[jQuery] Re: JSON Help?

2007-10-06 Thread sgrover
Got it I think I had a semicolon at the end of my json array. Took that off, and things started working fine. The semicolon was originally added to help me troubleshoot (i.e. cut/paste the block into a javascript variable) - this was the case with the new line characters too. I've also

[jQuery] Re: JSON Help?

2007-10-06 Thread sgrover
Thanks. I'll look into this. The various fields are escaped with PHP's json_encode function. So I'll see if I need to pre-process line feeds. Shawn Jeffrey Kretz wrote: > I'm not sure if this is the issue, but I noticed that you have line feeds > inside your string values. The server-side J

[jQuery] Re: JSON Help?

2007-10-06 Thread Jeffrey Kretz
I'm not sure if this is the issue, but I noticed that you have line feeds inside your string values. The server-side JSON parser I use replaces all line breaks within a string value with control characters (in addition to escaping quotes). val.Replace("\"", "\\\"").Replace("\r", "").Replace("\n"

[jQuery] Re: JSON Help?

2007-10-06 Thread Michael Geary
That's not JSON code. * JSON doesn't use a () wrapper around the whole thing. * JSON requires all property names to be double-quoted, e.g. "billed":null. * JSON does not allow executable code such as "new Date(...)". You can use the plain date strings instead and execute the "new Date" on them