Get specific query value wixLocation?

Hi,

This is probably really simple and I’m being dense, but how do you get the specific value of a query given the key.

For instance, let’s say I define a query:

wixLocation.queryParams.add({
 "day": y //I defined y above
});

Later, how can I get the value of the “day” query key from the URL?

Thanks!

Hey @ajanistella :raised_hand_with_fingers_splayed:

You can access the properties of the query by using the query object, here’s how:

const day = wixLocation.query.day;

It’s your responsibility to check if the property exist on the query or not before assigning its value to variable or use it in your code.

Hope this helps~!
Ahmad

Thank you! I just found this through the channels, sorry you had to spend your time because of my lack of good Google search terms!

@ajanistella No worries friend, we’re here to help :wink: