javascript - Select menu item link returns undefined -


the action want change video respective item when keyboard "enter" returns me error "undefined" has plugin i'm using select items. aspect video alone should not loaded page (ajax).

javascript:

$.getjson("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3d'http%3a%2f%2frss.cnn.com%2fservices%2fpodcasting%2fac360%2frss.xml'%20and%20itempath%3d%22%2f%2fchannel%22&format=json&diagnostics=true&callback=?", function (data) {      // load titles patch json     console.log(data.query.results.channel.item);     var titles = data.query.results.channel.item.map(function (item) {         return item.title;      });     var urls = data.query.results.channel.item.map(function (item) {         return item.origlink;      });     console.log(titles);     $(".container-list-podcast ul").append('<li>' + titles.join('</li><li>'));     $(".container-list-podcast ul li").each(function (key, value) {         var text = $(this).text();         $(this).html('<a href="' + urls[key] + '">' + text + '</a>');     });     $(".container-list-podcast ul li a").click(function () {         var href = $(this).attr('href');         alert(href);         $("#myvideo").attr("src", href).get(0).play();         return false;     })     // load navigation key     = $('.nav_holder li').keynav(function () {         return window.keynavigationdisabled;     }); }); 

jsfiddle

since using cross domain request should make sure server connect support requests this.

but need tell jquery support request doing following:

 $.support.cors = true; 

full answer can seen in jquery site


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -