首页 > 解决方案 > 如何使用 jquery 从 URL 加载内容

问题描述

下面的代码适用于我使用相同的网址

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
 $("button").click(function(){
   $("#div1").load("https://www.samewebsiteurl h1");
 });
});
</script>
</head>
<body>

<div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div>

<button>Get External Content</button>

</body>
</html>

我也想在同一个网站上获取我的网站内容,但由于我在 Blogger 上的网站,它在 BlogSpot 中不起作用。这是我的博客之一的示例

http://ethiopian-adv.blogspot.com/2021/02/chemicals-and-conditioners-for-your.html

请帮我获取它的帖子标题。

标签: javascripthtmljquery

解决方案


推荐阅读