Hello Query Parameters

Manage the query parameters in the current page's URL.

Introduction Last updated: 18 Mar 2025

About


  • In this example, we use the `location``wix-location-frontend` module API to allow site visitors to add, update, remove, and get query parameters from the current page’s URL.

APIs


How we built it


We added the following to our site:

Page Elements

Home

1. A container for adding or updating a query parameter containing:

  • Text input elements where the user can enter a key and value for a new query parameter.
  • An “Add/Update a query parameter” button to add or update the query parameter.

2. A container for removing a query parameter containing:

  • A text input element where the user can enter the key of the query parameter to remove.
  • A “Remove a query parameter” button to remove the query parameter

3. A container for getting the query parameters on the page:

  • A “Get query parameters” button to get the query parameters on the page.

A disabled text input element that displays the retrieved query parameters.

Frontend Code

Home

The code handles the 3 types of functionality for managing query parameters provided by our interface. In this file, we:

  1. Add an onClick() event handler to the “Add/Update a query parameter” button. The handler calls queryParams.add() to add or update the query parameter. 
  2. Add an onClick() event handler to the “Remove a query parameter” button. The handler calls queryParams.remove() to remove the query parameter. 
  3. Add an onClick() event handler to the “Get query parameters” button. The handler gets the list of query parameters from query.

Code Snippets


Home
Copy

Get Help


Join the community

Join the Wix Studio community on Discord, where experienced developers and fellow creators come together to share tips, troubleshoot issues, and collaborate.

Hire a developer

Building a coded solution on your own can be challenging. Let an experienced Wix developer build it for you, so you can keep working on your site or business. Visit the Wix Marketplace to find a trusted developer.

Did this help?