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

Using group by in MySQL always results in error 1055 (recommended)

Because using group by in MySQL always results in...

A brief discussion on Linux signal mechanism

Table of contents 1. Signal List 1.1. Real-time s...

Detailed tutorial on installing Nginx 1.16.0 under Linux

Because I have been tinkering with Linux recently...

Essential bonus items for optimizing and packaging the front end of Vue projects

Table of contents Preface 1. Routing lazy loading...

Deploy Varnish cache proxy server based on Centos7

1. Varnish Overview 1. Introduction to Varnish Va...

VMware12 installs Ubuntu19.04 desktop version (installation tutorial)

1. Experimental description In the virtual machin...

React implements the expansion and collapse function of complex search forms

Give time time and let the past go. In the previo...

How to implement Vue binding class and binding inline style

Table of contents Binding Class Binding inline st...

Two ideas for implementing database horizontal segmentation

introduction With the widespread popularity of In...

How to enable the slow query log function in MySQL

The MySQL slow query log is very useful for track...

Docker Tutorial: Using Containers (Simple Example)

If you’re new to Docker, take a look at some of t...

Native JavaScript implementation of progress bar

The specific code for JavaScript to implement the...

Share 5 JS high-order functions

Table of contents 1. Introduction 2. Recursion 3....

2 methods and precautions for adding scripts in HTML

How to add <script> script in HTML: 1. You c...