[jQuery] Re: JSON how to transform an object into an array?

2009-08-13 Thread Old Orange Juice
It still depends on apache configs.. you can confiure how much the access log puts out regarding that in LogLevel or LogFormat directive.. see the docs for more details. a good place to start if you are really concerned: http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#logformat On Aug

[jQuery] Re: JSON how to transform an object into an array?

2009-08-12 Thread Dhruva Sagar
I think this is what you are looking for data = eval ( '(' + data + ')' ); Thanks Regards, Dhruva Sagar. Jonathan Swifthttp://www.brainyquote.com/quotes/authors/j/jonathan_swift.html - May you live every day of your life. On Wed, Aug 12, 2009 at 3:18 PM, Mark johanns.m...@gmail.com wrote:

[jQuery] Re: JSON how to transform an object into an array?

2009-08-12 Thread Liam Potter
Shouldn't you be using $.getJSON instead? Mark wrote: Hi all. I got an php page who picks up data out of my data base and puts it in a multidimensinal array. That array is being encoded to Json $event = json_encode($super_array); Then i made an javasript get funtion to get that array to my

[jQuery] Re: JSON how to transform an object into an array?

2009-08-12 Thread Mark
yeah that i was thinking to but the problem is that you get. [object Object] if you alert out data again. On Aug 12, 11:53 am, Dhruva Sagar dhruva.sa...@gmail.com wrote: I think this is what you are looking for data = eval ( '(' + data + ')' ); Thanks Regards, Dhruva Sagar. Jonathan

[jQuery] Re: JSON how to transform an object into an array?

2009-08-12 Thread Dhruva Sagar
Well because it is an object.If you using firefox you should try alert(data.toSource()); after you've done the eval. But also to keep in mind like Liam Potter suggested you should use $.getJSON and you wont have to do the eval. Thanks Regards, Dhruva Sagar. Samuel

[jQuery] Re: JSON how to transform an object into an array?

2009-08-12 Thread Dhruva Sagar
Also to note, after you have eval 'ed it, you can then access the data in this manner as per your data structure : data[0].id, so on Thanks Regards, Dhruva Sagar. Joan Crawfordhttp://www.brainyquote.com/quotes/authors/j/joan_crawford.html - I, Joan Crawford, I believe in the dollar. Everything

[jQuery] Re: JSON how to transform an object into an array?

2009-08-12 Thread Stephan Beal
On Aug 12, 11:48 am, Mark johanns.m...@gmail.com wrote: $event = json_encode($super_array); How about simply: $event = '['.$event.']'; on the server side, i personally recommend using the json2.js API (i.e. JSON.parse() and JSON.stringify()) over $.getJSON(). getJSON uses an HTTP GET, which

[jQuery] Re: JSON how to transform an object into an array?

2009-08-12 Thread Michael Geary
You don't need to eval the JSON data. Let jQuery do it for you. Simply change $.get to $.getJSON. Or, if you prefer, use $.ajax with dataType:'json' for more flexibility (such as the ability to have an error callback). Regarding the array vs. object coming from the server, that would be a

[jQuery] Re: JSON how to transform an object into an array?

2009-08-12 Thread Michael Geary
From: Mark $event = json_encode($super_array); From: Stephan Beal How about simply: $event = '['.$event.']'; If $event contains the JSON encoded object from the previous message, then this code would not convert that object into a JSON array. It would simply create an array of one

[jQuery] Re: JSON how to transform an object into an array?

2009-08-12 Thread Stephan Beal
On Aug 12, 8:22 pm, Michael Geary m...@mg.to wrote: on the server side, i personally recommend using the json2.js API (i.e. JSON.parse() and JSON.stringify()) over $.getJSON(). getJSON uses an HTTP GET, which is very rude vis-a-vis Apache logs (because all your JSON gets logged there in