[jQuery] Re: AJAX and JSON

2009-10-27 Thread MorningZ
yeah, if you are not using cross domain calls, dump the callback parameter there, it's totally no needed... and if you are not using cross domain, then you aren't/don't-need-to use or think about "jsonp" at all as for mime type of normal json: application/json or text/plain also works for fine (i

[jQuery] Re: AJAX and JSON

2009-10-27 Thread Mark Volkmann
On Mon, Oct 26, 2009 at 9:58 PM, MorningZ wrote: > > if this is your *exact* code > > $.getJSON(url + "?callback?", function (json) { > > then you're missing an equal sign > > $.getJSON(url + "?callback=?", function (json) { Good catch! Fortunately I had the = in my real code. I just forgot to t

[jQuery] Re: AJAX and JSON

2009-10-26 Thread MorningZ
if this is your *exact* code $.getJSON(url + "?callback?", function (json) { then you're missing an equal sign $.getJSON(url + "?callback=?", function (json) { As for the rest of your issue of "what to do", this post should help: http://groups.google.com/group/jquery-en/browse_thread/thread/f

[jQuery] Re: AJAX and JSON

2009-08-12 Thread Joey Derrico
Actually I am sending data to the server from a form so post is needed. But I do agree that normally get is teh better method if you don't need to send data to a server. Joey On Wed, Aug 12, 2009 at 2:27 PM, Michael Geary wrote: > > > > From: Michael Geary > > > Just use $.getJSON() or $.ajax()

[jQuery] Re: AJAX and JSON

2009-08-12 Thread Michael Geary
> > From: Michael Geary > > Just use $.getJSON() or $.ajax() with the 'json' or 'jsonp' > > dataType as needed. > From: Stephan Beal > Speaking of: i recommend AGAINST using getJSON() because it > muddles up my Apache logs horribly (the JSON gets encoded in > the request, which gets logged as

[jQuery] Re: AJAX and JSON

2009-08-11 Thread Michael Geary
m] On Behalf Of Joey Derrico Sent: Tuesday, August 11, 2009 12:17 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: AJAX and JSON Ok so I have used .ajax function to run my ajax and set type to data. It is getting (well posting) to a php file that echo's a json_encoded array. When it r

[jQuery] Re: AJAX and JSON

2009-08-11 Thread Joey Derrico
Ok so I have used .ajax function to run my ajax and set type to data. It is getting (well posting) to a php file that echo's a json_encoded array. When it returns I am using console.log to display the returned data. when I just use data it shows the JSON encoded data, but if I use data.key I get un

[jQuery] Re: AJAX and JSON

2009-08-11 Thread Stephan Beal
On Aug 11, 6:14 am, Cam Spiers wrote: > I also recommend using json2.js for anything more then just a basic > key-value json string. Another nice feature of json2.js is that you can use it to deeply clone objects: var orig = {}; var clone = JSON.parse(JSON.stringify(orig)); i've found tha

[jQuery] Re: AJAX and JSON

2009-08-11 Thread Stephan Beal
On Aug 11, 5:13 am, MorningZ wrote: > I'd also recommend against use of $.getJSON for a totally different > reason: > > There is no option to "catch" errors. You can: you have to set a global ajax error handler to catch it, though. Not pretty, but it's suitable for many simple cases (where a

[jQuery] Re: AJAX and JSON

2009-08-10 Thread Cam Spiers
I also recommend using json2.js for anything more then just a basic key-value json string. I ran into troubles with the standard jQuery json approach, when implementing a complex system that transfers a lot of json to and from the server. And as Michael Geary mentions: "If you want to *generate*

[jQuery] Re: AJAX and JSON

2009-08-10 Thread MorningZ
"Speaking of: i recommend AGAINST using getJSON()" I'd also recommend against use of $.getJSON for a totally different reason: There is no option to "catch" errors. getJSON: function(url, data, callback) { return jQuery.get(url, data, callback, "json"); }, so if something happens serv

[jQuery] Re: AJAX and JSON

2009-08-10 Thread Miket3
I'll just add my 2 cents from novice to novice. 1. JSON is just a lightweight markup language. Its like HTML, and more like XML but just without the weight. And it is easier to read with the eyeball. JSON uses {} squiggles and : and [] and others to markup the data. JSON {"CATALOG" : "JCPENNY"} X

[jQuery] Re: AJAX and JSON

2009-08-10 Thread Stephan Beal
On Aug 11, 12:26 am, "Michael Geary" wrote: > Just use $.getJSON() or $.ajax() with the 'json' or 'jsonp' dataType as > needed. Speaking of: i recommend AGAINST using getJSON() because it muddles up my Apache logs horribly (the JSON gets encoded in the request, which gets logged as urlencoded ga

[jQuery] Re: AJAX and JSON

2009-08-10 Thread Michael Geary
> > From: Joey Derrico > > > > I am a novice at AJAX and JSON (Ok, I am a novice at > > JavaScript.), and > > I am brand new to jQuery. I wanted to use JSON in a project I am > > working on and I read various tutorials on using JSON with jQuery > > however none of them answered some of my ques

[jQuery] Re: AJAX and JSON

2009-08-10 Thread Stephan Beal
On Aug 10, 9:58 pm, Joey Derrico wrote: > I am a novice at AJAX and JSON (Ok, I am a novice at JavaScript.), and I am > brand new to jQuery. I wanted to use JSON in a project I am working on and I > read various tutorials on using JSON with jQuery however none of them > answered some of my questi