Site Navigation

Nov 1, 2009

JQuery json with .get and .post

JQuery LogoI have been testing JQuery's Ajax features a bit late. I noticed that the $.get and $.post Ajax functions didn't seem to support json has a return type. Heck, it is not clear what kind of data the function is expecting.

So I did a little searching around. It turns out that both $.get and $.post have an optional 4th parameter. This allows you to set the data return type to: "xml", "html", "script", "json", "jsonp", or "text". The Code Central Blog has the explanation why the parameter is missing (and it explains why it was not included in some of my reference books). Details of the methods options can be found in the JQuery documentation.
Post a Comment

Favorite Links Feed