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

j Use Query to get URL parameter plug-in

php中世界最好的语言
php中世界最好的语言Original
2018-04-26 17:40:242038browse

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');

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

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

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]');

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

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

Set two parameters:

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

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

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

Clear all parameters:

var emptyQuery = $.query.empty();

Copy all parameters:

var stillTheSame = $.query.copy();

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!

Statement:
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