Div nested html without iframe

Div nested html without iframe
Recently, when doing homework, I needed to nest a page without using an iframe, so I had to nest it in a div using the jquery method.

Copy code
The code is as follows:

<script type="text/javascript">
$(document).ready(function() {
$("#button").click(function() {
$("#content").load("index.jsp");
});
});
</script>

The code is just this much, where #button is the id of a button and content is the div where you want to insert the HTML

And you can't just use $("#button").click(function() {}; because this is before the page is loaded, so you can't find the div you want after the page is loaded, so you have to add $(document).ready(function() {};

Another key point is that many people forget to reference jquery, so you must add <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

<<:  HTML+CSS+JS to implement the Don't Step on the Whiteboard game

>>:  SQL implementation of LeetCode (196. Delete duplicate mailboxes)

Recommend

Detailed explanation of Nginx timeout configuration

I recently used nginx in a project, and used Java...

MySQL Series 12 Backup and Recovery

Table of contents Tutorial Series 1. Backup strat...

Why node.js is not suitable for large projects

Table of contents Preface 1. Application componen...

How to use mixins in Vue

Table of contents Preface How to use Summarize Pr...

Detailed steps to install Nginx on Linux

1. Nginx installation steps 1.1 Official website ...

Sharing of SVN service backup operation steps

SVN service backup steps 1. Prepare the source se...

HTML page adaptive width table

In the pages of WEB applications, tables are ofte...

Historical Linux image processing and repair solutions

The ECS cloud server created by the historical Li...

Detailed explanation of several ways to create a top-left triangle in CSS

Today we will introduce several ways to use CSS t...

Detailed explanation of mixins in Vue.js

Mixins provide distributed reusable functionality...

JavaScript to achieve all or reverse selection function

This article shares the specific code of JavaScri...

Two ways to completely delete users under Linux

Linux Operation Experimental environment: Centos7...