jquery - 刷新网页时如何保留所需文件
问题描述
我有一个项目要求页面刷新但保留另一个页面的内容,但我不确定为什么我当前的实现不起作用。
我有3个文件如下:
测试6.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
<script src="jquery.pjax.js"></script>
</head>
<body>
<?php require_once "test10.php"?>
<div class="container" id="pjax-container">
Go to <a href="test9.php">next page</a>.
</div>
<script>
$(document).ready(function() {
$(document).pjax('a', '#pjax-container');
});
</script>
</body>
</html>
测试10.php
<div>
<h1>Hello</h1>
</div>
test9.php
<h1>this is test9</h1>
刷新test9时如何保留test10的内容?
解决方案
推荐阅读
- java - 如何在java中打印出X个排列?
- angular - Angular项目分解成模块
- java - java.io.FileNotFoundException(您的文件夹)(拒绝访问)
- c++ - Qt5如何使类成员小部件不能被删除
- git - 如果我从一个分支中删除提交,是否会从另一个分支中删除相同的提交?
- python - 从 csv 文件中删除所有具有特定值的行
- javascript - 嵌入 instagram HTML 帖子不显示图像
- android - 如何将 POST 请求从 Android 发送到 Elasticsearch
- c++ - OpenGL三角形总是白色的
- c++ - 表达式必须是 C++ 中的整数或无范围枚举类型?