Problem with XML parsing using jQuery -
the code here supposed place random images xml file layers. works display first image in xml instead of taking random nodes out of xml file. know why is?
$(function () { $.ajax({ type: "get", url: "myfakechanneldata.xml", datatype: "xml", success: changechannel }); }); function changechannel(xml) { $('#layer').fadeout(1000); var $limit = 4; $(xml).find("channel").each(function($limit) { var $channel = $(this); var image = $channel.attr('image'); $("#click").click(function () { $(".layer-container").empty(); $(".layer-container").append('<div class="layer1">' + '<img class="" alt="" src="' + image + '" />' + '</div></div>'); $(".layer-container").append('<div class="layer2">' + '<img class="" alt="" src="' + image + '" />' + '</div></div>'); $(".layer-container").append('<div class="layer3">' + '<img class="" alt="" src="' + image + '" />' + '</div></div>'); $(".channel").fadein(1000); var random = math.floor(limit * math.random()); var mynewchannel = remix(random); mynewchannel(random); }); }); }
could because of typo: math.floor(limit * math.random());
instead of math.floor($limit * math.random());
?
Comments
Post a Comment