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

How to install Tomcat-8.5.39 on centos7.6

Here is how to install Tomcat-8.5.39 on centos7.6...

MySQL slow query optimization: the advantages of limit from theory and practice

Many times, we expect the query result to be at m...

How to use VUE and Canvas to implement a Thunder Fighter typing game

Today we are going to implement a Thunder Fighter...

Implementation example of Docker rocketmq deployment

Table of contents Preparation Deployment process ...

js to achieve interesting countdown effect

js interesting countdown case, for your reference...

JavaScript function encapsulates random color verification code (complete code)

An n-digit verification code consisting of number...

Vue3.0+vite2 implements dynamic asynchronous component lazy loading

Table of contents Create a Vite project Creating ...

Example of Vue uploading files using formData format type

In Vue, we generally have front-end and back-end ...

How to create a virtual environment using virtualenv under Windows (two ways)

Operating system: windowns10_x64 Python version: ...

CentOS7.5 installation of MySQL8.0.19 tutorial detailed instructions

1. Introduction This article does not have screen...

Vue implements two routing permission control methods

Table of contents Method 1: Routing meta informat...

How are Vue components parsed and rendered?

Preface This article will explain how Vue compone...

How to use Linux commands in IDEA

Compared with Windows system, Linux system provid...

How to use module fs file system in Nodejs

Table of contents Overview File Descriptors Synch...

How to match the size of text in web design: small text, big experience

With the rise of mobile terminals such as iPad, p...