Well deserializing JSON is quite trivial - you just need to do an eval on
the string to get the object.
// returns a object
$("#example").click(function() {
$.post('http://localhost/e/', function(json) {
eval "json="+json;
alert(json);
}, "json");
});
-Ashutosh
On 3/17/07, Bojan <[EMAIL PROTECTED]> wrote:
Hey Chris, I wasn't aware that I could pass in a type to the post() func.
I tried that and I still got the the data back as a string instead of an
object. It's in the correct form {'a':4, 'b':3} but for some reason it
doesn't work. I tried the same with the getJSON() funct and it returns an
object as it should.
I'm using the following test:
// returns an object
$("#example").click(function() {
$.getJSON('http://localhost/e/', function(json) {
alert(json);
});
});
// returns a string
$("#example").click(function() {
$.post('http://localhost/e/', function(json) {
alert(json);
}, "json");
});
I'm using the latest jquery.
--
-bo
On 3/17/07, Chris Domigan <[EMAIL PROTECTED] > wrote:
> You can roll your own:
>
> jQuery.extend({
> postJSON: function( url, data, callback ) {
> return jQuery.post(url, data, callback, "json");
> }
> });
>
> Chris
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
--
Reach1to1 Technologies
http://www.reach1to1.com
http://on2.biz
[EMAIL PROTECTED]
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/