gpt4 book ai didi

javascript - (this).parent().find 无法在 ajax 调用中获取响应

转载 作者:行者123 更新时间:2023-12-03 09:07:17 25 4
gpt4 key购买 nike

$(".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);
}
});
});

此处警报显示特定的数据 ID,但

content=$(this).parent().find(".content-full");

这不会在内容完整的 div 中显示具有特定数据 ID 的数据代码有什么问题或者其他什么吗?

如果我使用(."content-full");查询会显示数据;而不是

$(this).parent().find(".content-full");

最佳答案

在 ajax 回调中,您使用 $content,但将变量声明为 content。这可能是问题所在吗?你的问题不清楚。你想达到什么目的?

关于javascript - (this).parent().find 无法在 ajax 调用中获取响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32164795/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com