Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative to sending comma separated parameter by querystring

I am trying to send querystring parameter as below but i think that using comma in querystring is not valid so what is better alternative to comma separator for path parameter?

<a href="/?path=1,2,3"></a>

I don't want to send like <a href="/?path=1&path=2&path=3"></a> which can be quite long.

like image 911
Freshblood Avatar asked Dec 02 '11 16:12

Freshblood


People also ask

How do you pass parameters in Querystring?

To pass in parameter values, simply append them to the query string at the end of the base URL. In the above example, the view parameter script name is viewParameter1.

How do I pass multiple parameters to a URL?

Any word after the question mark (?) in a URL is considered to be a parameter which can hold values. The value for the corresponding parameter is given after the symbol "equals" (=). Multiple parameters can be passed through the URL by separating them with multiple "&".

Can we send comma in URL?

A comma in a string should be encoded as %2C . It is recommended you use your platform's normal URL building libraries to automatically encode your URLs, to ensure the URLs are properly escaped for your platform.


1 Answers

You can use %2C, wich is the url-encoded value of ,.

like image 189
rabusmar Avatar answered Sep 23 '22 01:09

rabusmar