Novice SolutionFor example, if I want a sidebar navigation on a page, click on one of the a tags, and the p on the right will load the corresponding html file. So how can thinkphp implement such a function? Use jq's load? post? Do I need to write the head and body tags in the loaded HTML? Or can I just write the content that needs to be loaded in the p on the right? And how to deal with their css js?
This has nothing to do with TP anymore
If you follow your method, you can asynchronously request the required html code, and then put it in p on the right. Don’t write the loaded html head and body, just write the html in p. Similarly, you can try iframe, click on the sidebar navigation, and directly let the iframe load a link
You can try to include sidebar navigation in each page, for example, a.html b.html. Click the sidebar navigation of a.html to jump directly to b. Anyway, b also has sidebar navigation (sidebar navigation is in view The level can be written as public, and the tp template should also support it)
Using jq’s load or post, you can directly write the content that needs to be loaded in the p on the right. css js can be used on this page or css js file writer
ajax jquery’s $.get or $.post can achieve it