jquery json help

Soldato
Joined
12 May 2007
Posts
3,896
Location
Bristol
I've created a script which grabs data from an xml file and uses it to animate some objects on a page. Unfortunately, I've just been told that I need to use jSON instead of XML.
Now, I've created a new script but it's just not working and I have no idea why. Anyone have any clue?


Working XML
http://www.tripnologist.com/example/xml/

Not working jSON
http://www.tripnologist.com/example/json/

Files for both if someone is feeling kind and wants to give me a hand.
http://www.tripnologist.com/example/example.zip
 
I have it working now. I just had the js wrong.

Code:
$(document).ready(function(){
        $.ajax({
                type: "GET",
                url: "data.txt",
                dataType: "json",
                success: function(data) {
                        for (var i in data.week) {
                                var day = data.week[i];
                                var bc = $("." + i +" .bubbleContainer");
                                bc.animate({"top": day.positiontop, "opacity": day.opacity, "width": day.size, "backgroundColor": day.background }, day.duration );
                                bc.children("img").animate({ "backgroundColor": day.background }, day.duration );
                        }
                }
        });
});
 
Back
Top Bottom