Reputation: 10288
could someone please explain why the following code is throwing an error?
// JavaScript Document
$(document).ready(function(){
$(".port-box").css("display", "none");
$('ul#portfolio li a').bind('click', function(){
var con_id = $(this).attr("id");
if( con_id.length !== 0 ) {
$.get('./act_web_designs_portfolio', function(data){
var content = data.find("#" + con_id + "-content").html();
alert(content);
});
return false;
}
});
});
Firefox says:
data.find is not a function
Any help much appreciated, regards, Phil
Upvotes: 6
Views: 17696
Reputation: 4460
Because data
is not a jQuery object - it's usually a string containing the markup of the returned page.
Use $(data).find(...)
instead - that will probably do it.
Upvotes: 2
Reputation: 449415
data
is going to be a string.
If you're expecting data
to contain HTML, try
var content = $(data).find(....)
Upvotes: 12