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

HTML elements (tags) and their usage

a : Indicates the starting or destination positio...

Install mysql5.7 on Ubuntu 18.04

Ubuntu 18.04 installs mysql 5.7 for your referenc...

Detailed explanation of the construction and use of docker private warehouse

1. Download the repository image docker pull regi...

Instructions for recovering data after accidental deletion of MySQL database

In daily operation and maintenance work, backup o...

Html easily implements rounded rectangle

Question: How to achieve a rounded rectangle usin...

Detailed explanation of mktemp, a basic Linux command

mktemp Create temporary files or directories in a...

Vue implements internationalization of web page language switching

1. Basic steps 1: Install yarn add vue-i18n Creat...

Bugs encountered when using mybatis-generator with mysql8.0.3 in IDEA

1. Add the plug-in and add the following configur...

Detailed installation steps for MySQL 8.0.11

This article shares the installation steps of MyS...

Detailed steps for porting busybox to build a minimal root file system

Busybox: A Swiss Army knife filled with small com...

Several common methods of sending requests using axios in React

Table of contents Install and introduce axios dep...

Detailed explanation of styles in uni-app

Table of contents Styles in uni-app Summarize Sty...

Detailed explanation of this reference and custom properties in JavaScript

Table of contents 1. this keyword 2. Custom attri...

Detailed explanation of the spacing problem between img tags

IMG tag basic analysis In HTML5, the img tag has ...