gpt4 book ai didi

javascript - 使用 jquery load() 从外部页面获取 h1 的内容

转载 作者:行者123 更新时间:2023-12-01 06:44:57 24 4
gpt4 key购买 nike

我有一个媒体维基,我想将内容从其中获取到另一个页面。所以我有: http://bourlo.net/wiki/index.php/Lunet

并且希望在另一个页面上的 Bootstrap 模式中显示其中的部分内容: http://bourlo.net/stack/

维基页面的标题通过以下方式检索:

  $("#wikiModal h4.modal-title")
.load( "http://bourlo.net/wiki/index.php/Lunet .firstHeading");

这有效,是的!但我不想要完整的

<h1 id="firstHeading" class="firstHeading" lang="nl-informal">Lunet</h1>

<h4>来自模式,但只有内容 >>> Lunet

我该怎么做?

最佳答案

您需要使用其他ajax方法代替。举个例子:

$.get("http://bourlo.net/wiki/index.php/Lunet", function(html){
var txt = $(html).find('.firstHeading').text();
$("#wikiModal h4.modal-title").text(txt);
});

关于javascript - 使用 jquery load() 从外部页面获取 h1 的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34135016/

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