All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

EE pagination converts colons in Low Search parameters to %3A

MattV 19 Jan 2018 17:41 question, complete

I've been working with a Low Search implementation in which I use jQuery to grab a search parameter from the URL segment and update the options for a secondary filter.

My search results URL looks something like this:
results?child:relatedfield=selected-option

The relevant part of my script looks something like this:
var selectedOption = $.urlParam("child:relatedfield");

Everything works smoothly until I go to a second page. When the EE pagination kicks in, the colons in my URL get encoded, changing to:

results/P5?child%3Arelatedfield=selected-option

As a result, my script no longer finds the proper option.

Is there a way to avoid the extra URL encoding when paginated? Alternatively, is there a way with javascript/jQuery that I could accommodate either encoding?

(I'm working with EE 3.5.11 and Low Search 5.1.0)

Replies

  1. Low 19 Jan 2018 19:31

    This isn't really a LS issue, as LS will work with the (un)encoded query string.

    You could probably do it without JavaScript altogether, but if you must, try this:

    var selectedOption = $.urlParam("child:relatedfield") || $.urlParam("child%3Arelatedfield");

  2. MattV 19 Jan 2018 19:35

    Fair enough. Thanks for the js pointer. I'll give that a try.

    Have a great weekend!