javascript - 如何使用 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
请帮我获取它的帖子标题。
解决方案
推荐阅读
- javascript - 如何使用 apache 和 ReactJS 在 htdocs 中路由两个项目?
- apache-kafka - Kafka 代理处于只读模式
- java - 仅带来我从共享库中导入的类使用的 Maven 依赖项的最佳方法是什么?
- c# - C# .日期语法
- python - 增量实体解析/记录链接的最佳(PostgreSQL?)数据模型和处理
- reactjs - 使用 localhost 而不是 localhost:8081 我有 nginx、webpack、react stack 如何?
- python-multiprocessing - 为什么某些代码在 python 进程中的函数中不起作用?
- firebase - 如何为我的数据库编写 firebase 规则,以防止某些用户能够写入?
- php - 使用 html 循环通过 github 图像目录
- javascript - 在 Redux React 中将对象添加到嵌套数组