HTML page jump passing parameter problem

HTML page jump passing parameter problem

The effect is as follows:

a page

After clicking the jump button

The corresponding value can be obtained on page b.

The code is as follows:

a page:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <script src="js/jquery-3.0.0.min.js"></script>
    <script src="js/jquery.params.js"></script>
    <title>a page</title>
    <script>
        $(function(){
             name = $("#name").text();
             age = $("#age").text();
            $("#btn").on("click",function(){
               jump1();
            });
        });
        function jump1(){
            url = "b.html?name="+name+"&age="+age;//Contents are concatenated here window.location.href = url;
        }
    </script>
</head>
<body>
   <div id="name">tony</div>
   <div id="age">23</div>
   <button id="btn">Jump</button>
</body>
</html>

Page b to jump to:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <script src="js/jquery-3.0.0.min.js"></script>
    <script src="js/jquery.params.js"></script>
    <title>Page b</title>
    <script>
        $(function(){
           getData1();
        });
        function getData1(){
            var name = $.query.get("name");
            var age = $.query.get("age");
            $("#name").text(name);
            $("#age").text(age);
        }
    </script>
</head>
<body>
   <div id="name"></div>
   <div id="age"></div>
</body>
</html>

The above is the problem of passing parameters in HTML page jump that I introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

<<:  Using CSS3 and JavaScript to develop web color picker example code

>>:  Public multi-type attachment image upload area in Vue page and applicable folding panel (sample code)

Recommend

The concept and characteristics of MySQL custom variables

A MySQL custom value is a temporary container for...

Building command line applications with JavaScript

Table of contents 1. Install node 2. Install Comm...

Example of how to achieve ceiling effect using WeChat applet

Table of contents 1. Implementation 2. Problems 3...

Vue uses vue-quill-editor rich text editor and uploads pictures to the server

Table of contents 1. Preparation 2. Define the gl...

Summary of uncommon js operation operators

Table of contents 2. Comma operator 3. JavaScript...

Why does using limit in MySQL affect performance?

First, let me explain the version of MySQL: mysql...

Write a dynamic clock on a web page in HTML

Use HTML to write a dynamic web clock. The code i...

Two ways to clear float in HTML

1. Clear floating method 1 Set the height of the ...

VMware installation of Centos8 system tutorial diagram (Chinese graphical mode)

Table of contents 1. Software and system image 2....

Detailed explanation of the properties and functions of Vuex

Table of contents What is Vuex? Five properties o...

The difference and introduction of ARGB, RGB and RGBA

ARGB is a color mode, which is the RGB color mode...

jQuery realizes the shuttle box effect

This article example shares the specific code of ...

XHTML introductory tutorial: Use of list tags

Lists are used to list a series of similar or rela...

MySQL 8.0.20 installation and configuration method graphic tutorial

MySQL download and installation (version 8.0.20) ...