[英](this).parent().find not working for getting response in ajax call
$(".content-short").click(function() {
$(".content-full").empty();
var contentid=$(this).parent().find(".content-full").attr('data-id');
var content=$(this).parent().find(".content-full");
alert(contentid);
var collegename = $(this).attr('data-id');
$.ajax({
type: "post",
url: "contenthome.php",
data: 'collegename=' + collegename,
dataType: "text",
success: function(response) {
$content.html(response);
}
});
});
here the alert displays the specific data-id but 警报在此处显示特定的数据ID,但
content=$(this).parent().find(".content-full");
this didn't displays data in content-full div with that specific data-id anything wrong in the code or something else? 这不会在具有特定数据ID的content-full div中显示数据-代码中是否有任何错误或其他问题?
the query displays data if i use(."content-full"); 如果我使用(。“ content-full”),查询将显示数据; instead of 代替
$(this).parent().find(".content-full");
Inside the ajax callback you are using $content
, but you declare your variable as content
. 在ajax回调内部,您正在使用$content
,但是您将变量声明为content
。 May that be the problem? 可能是问题所在吗? Your question is not clear. 您的问题不清楚。 What are you trying to achieve? 您想达到什么目的?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.