binding plugin to ajax call
I take categories from another page with an ajax call. The problem is, data taken from another page needs to be part of another of an event; tabs plugin.
I get the following error with this code.
开发者_运维问答 $.ajax({
dataType: "xml",
success: function(xml) {
$(xml).find('row').each(function(){
var id = $(this).attr('id');
var CategoryName = $(this).find('CategoryName');
});
}
}).live('click', function() {
$("div.row-title").tabs("div.redpanes > div");
});
CategoryName is a string, not a jQuery object.
var CategoryName = $(this).find('CategoryName').text();
find aint going to work!
You're probably looking for:
$(xml).find('row').each(function(){
var id = $(this).attr('id');
var CategoryName = $(this).find('CategoryName');
$("<div class='tab fleft'><a href='http://www.refinethetaste.com/FLPM/content/home/index.cs.asp?Process=ViewVideos&CATEGORYID="+ id +"'>"+ CategoryName.text() + "</a></div>").appendTo("#VCategories");
CategoryName.find("div.row-title .red").tabs("div.panes > div");
});
CategoryName
is a string, not a DOM element. You can not run find()
on it.
精彩评论