Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7409763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:07:55+00:00 2026-05-29T06:07:55+00:00

#&q=car&category=Car%20Audio%2CAccessories&brand= I borrowed a this function from a previous question asked on SO: function

  • 0
 #&q=car&category=Car%20Audio%2CAccessories&brand=

I borrowed a this function from a previous question asked on SO:

function insertParam(key, value)
{
key = escape(key); value = escape(value);

var kvp = document.location.hash.substr(1).split('&');

var i=kvp.length; var x; while(i--) 
{
    x = kvp[i].split('=');

    if (x[0]==key)
    {
            x[1] = value;
            kvp[i] = x.join('=');
            break;
    }
}

if(i<0) {kvp[kvp.length] = [key,value].join('=');}

//this will reload the page, it's likely better to store this until finished

document.location.hash = kvp.join('&'); 
}

I use it like this:

    insertParam("category",xy);
    insertParam("brand",zy);

My problem is it is decoding comma’s to %2C. I know I can handle the characters on the server side, but how can I make it look pretty with javascript? By pretty I mean replace %2c with a comma.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:07:55+00:00Added an answer on May 29, 2026 at 6:07 am

    decodeURIComponent(foo) is the thing you are looking for.

    Edit: Misread your question.

    Use replace(/&/g, "%26").replace(/=/g, "%3D") instead of escape on key and value to do this.

    None of the 3 functions encodeURI, encodeURIComponent or encode work for this task, because they either encode commas or don’t encode &=.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

webcategory.aspx?q=webcategory:Car&rows=0 From this querystring I'm extracting ' webcategory:Car ' (q) and inserts it into
What I'd like is for this class class Car { public function __construct(Engine $engine,
The code in question is this: (define multirember&co (lambda (a lat col) (cond ((null?
All, I recently posted this question on DAL design. From that it would seem
Here is the draw function which draws the parts of the car, in this
I have this code $myNewClass->cars =& Orders_Car::GetRecords($myNewClass->searchString); ^ what is & doing there. thanks
My use case: map<string, Car> cars; bool exists(const string& name) { // somehow I
In the below javascript, this refers to Car object and search_id refers to the
I came across this strange code snippet which compiles fine: class Car { public:
Is there any way to clean up this type of loop using LINQ? List<Car>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.