Is it possible to search through json result with jQuery

Posted by mickyjtwin on Stack Overflow See other posts from Stack Overflow or by mickyjtwin
Published on 2010-05-07T05:17:53Z Indexed on 2010/05/07 5:48 UTC
Read the original article Hit count: 440

Filed under:
|
|

What I'm trying to achieve, is to output a json list that contains a list of Css classes, and their corresponding url records, i.e.

var jsonList = [{"CSSClass":"testclass1","VideoUrl":"/Movies/movie.flv"},{"CSSClass":"testclass2","VideoUrl":"/Movies/movie2.flx"}]; //]]>

foreach item in the list I am adding a click event to the class...

$.each(script, function() {
        $("." + this.CSSClass, "#pageContainer").live('click', function(e) {
            videoPlayer.playMovie(this);
            return false;
        });
    });

What I'm wondering, is if I can somehow get the corresponding url from the jsonlist, without having to loop through them all again, searching for CSSClass, or adding the url to the link as an attribute?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JSON