json plugin..

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

json plugin..

pduran
I've been playing with the json plugin for jquery (
http://mg.to/2006/01/25/json-for-jquery ).

It says that the callback is called with this setup as the html element where it
was applied, but I got the window object instead. Someone tested it successfuly?

Thanks!


_______________________________________________
jQuery mailing list
[hidden email]
http://jquery.com/discuss/
Reply | Threaded
Open this post in threaded view
|

Re: json plugin..

Michael Geary
> I've been playing with the json plugin for jquery (
> http://mg.to/2006/01/25/json-for-jquery ).
>
> It says that the callback is called with this setup as the
> html element where it was applied, but I got the window
> object instead. Someone tested it successfuly?

Oops, I goofed, sorry about that. A quick and easy fix would be to change
this line:

            _$_.each( function() { callback(json); } );

to:

            _$_.each( function() { callback( json, this ); } );

and then write your callback function as:

   function mycallback( json, element ) {
      ...
   }

-Mike


_______________________________________________
jQuery mailing list
[hidden email]
http://jquery.com/discuss/