Home > Web Front-end > JS Tutorial > j Use Query to get URL parameter plug-in

j Use Query to get URL parameter plug-in

php中世界最好的语言
Release: 2018-04-26 17:40:24
Original
2067 people have browsed it

This time I will bring you j using Query to get URL parameters plug-in, and what are the precautions for using jQuery to get URL parameters plug-in. Here is a practical case, let’s take a look. .

If you want to get the test, you can introduce the plug-in,
Get it as follows:

var test = $.query.get('test');
Copy after login

If the parameters have multiple identical names, you can do this:

var arr = $.query.get('testy');
Copy after login

Output: [Value 1, Value 2, Value 3...]
If you want to get one of multiple identical names, you can do this:

var arrayElement = $.query.get('testy[1]');
Copy after login

This plug-in can not only obtain parameters, but also set parameters.
Set one parameter:

var newUrl = $.query.set("section", 5).toString();
Copy after login

Set two parameters:

var newUrl = $.query.set("section", 5).set("action", "do").toString();
Copy after login

Output: "?action=do§ion=5"
Delete one parameter:

var oldQueryAgain = $.query.REMOVE("type");
Copy after login

Clear all parameters:

var emptyQuery = $.query.empty();
Copy after login

Copy all parameters:

var stillTheSame = $.query.copy();
Copy after login

I believe I read the case in this article You have mastered the method. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Jquery digital scroll switching plug-in implementation method

jquery operation animation display and hiding effects

The above is the detailed content of j Use Query to get URL parameter plug-in. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template