I couldn't find in the jQuery document if any of its AJAX methods SAFELY evaluates a JSON response to a $.post.
+1
A:
You can change the type
parameter on the $.post function:
$.postJSON = function(url, data, callback) {
$.post(url, data, callback, "json");
};
CMS
2009-07-20 01:01:35
Haha, I copied from the exact same feature request. Great minds think alike :P
Salty
2009-07-20 01:05:02
A:
jQuery's JSON eval is supposedly safe, and their $.getJSON method seems to work well. All you have to do is pass the "json" parameter to the $.post and it'll automatically parse the JSON. Like so:
$.post(url, data, callback, "json");
Salty
2009-07-20 01:03:11