Questions tagged [query-string]

The part of a URL after the ? (question mark), containing parameter=value pairs separated by & (ampersand). In a request made to a web application at a particular URL, the parameter+value data in the query string is parsed/consumed by the web application on the backend that receives the request.

See also: https://en.wikipedia.org/wiki/Query_string

3924 questions
2695
votes
73 answers

How can I get query string values in JavaScript?

Is there a plugin-less way of retrieving query string values via jQuery (or without)? If so, how? If not, is there a plugin which can do so?
Subliminal Hash
  • 13,340
  • 20
  • 70
  • 99
1444
votes
15 answers

When are you supposed to use escape instead of encodeURI / encodeURIComponent?

When encoding a query string to be sent to a web server - when do you use escape() and when do you use encodeURI() or encodeURIComponent(): Use escape: escape("% +&="); OR use encodeURI() /…
Adam
  • 27,361
  • 15
  • 56
  • 70
1316
votes
23 answers

How to get GET (query string) variables in Express.js on Node.js?

Can we get the variables in the query string in Node.js just like we get them in $_GET in PHP? I know that in Node.js we can get the URL in the request. Is there a method to get the query string parameters?
XMen
  • 25,629
  • 39
  • 95
  • 148
689
votes
33 answers

How to get URL parameter using jQuery or plain JavaScript?

I have seen lots of jQuery examples where parameter size and name are unknown. My URL is only going to ever have 1 string: http://example.com?sent=yes I just want to detect: Does sent exist? Is it equal to "yes"?
LeBlaireau
  • 14,709
  • 30
  • 95
  • 169
592
votes
4 answers

What is the maximum possible length of a query string?

Is it browser dependent? Also, do different web stacks have different limits on how much data they can get from the request?
Brian Sullivan
  • 25,394
  • 22
  • 73
  • 88
580
votes
8 answers

How to access the GET parameters after "?" in Express?

I know how to get the params for queries like this: app.get('/sample/:id', routes.sample); In this case, I can use req.params.id to get the parameter (e.g. 2 in /sample/2). However, for url like /sample/2?color=red, how can I access the variable…
Hanfei Sun
  • 39,245
  • 33
  • 107
  • 208
556
votes
42 answers

Query-string encoding of a Javascript Object

Do you know a fast and simple way to encode a Javascript Object into a string that I can pass via a GET Request? No jQuery, no other frameworks - just plain Javascript :)
napolux
  • 13,486
  • 7
  • 48
  • 68
530
votes
30 answers

Elasticsearch query to return all records

I have a small database in Elasticsearch and for testing purposes would like to pull all records back. I am attempting to use a URL of the form... http://localhost:9200/foo/_search?pretty=true&q={'matchAll':{''}} Can someone give me the URL you…
John Livermore
  • 26,237
  • 38
  • 112
  • 191
511
votes
37 answers

How to build a query string for a URL in C#?

A common task when calling web resources from a code is building a query string to including all the necessary parameters. While by all means no rocket science, there are some nifty details you need to take care of like, appending an & if not the…
Boaz
  • 21,983
  • 21
  • 65
  • 76
496
votes
10 answers

How do you access the query string in Flask routes?

How do you access query parameters or the query string in Flask routes? It's not obvious from the Flask documentation. The example route /data below illustrates the context that I would like to access that data. If someone requests something like…
Tampa
  • 62,379
  • 105
  • 250
  • 388
424
votes
11 answers

How to pass an array within a query string?

Is there a standard way of passing an array through a query string? To be clear, I have a query string with multiple values, one of which would be an array value. I want that query string value to be treated as an array- I don't want the array to…
Yarin
  • 144,097
  • 139
  • 361
  • 489
391
votes
29 answers

How can I add or update a query string parameter?

With javascript how can I add a query string parameter to the url if not present or if it present, update the current value? I am using jquery for my client side development.
amateur
  • 40,217
  • 59
  • 181
  • 303
380
votes
9 answers

Is an HTTPS query string secure?

I am creating a secure web based API that uses HTTPS; however, if I allow the users to configure it (include sending password) using a query string will this also be secure or should I force it to be done via a POST?
John
  • 27,040
  • 17
  • 82
  • 121
378
votes
11 answers

Parse query string in JavaScript

I need to parse the query string www.mysite.com/default.aspx?dest=aboutus.aspx. How do I get the dest variable in JavaScript?
sinaw
  • 3,825
  • 2
  • 14
  • 5
343
votes
11 answers

Get URL query string parameters

What is the "less code needed" way to get parameters from a URL query string which is formatted like the following? www.mysite.com/category/subcategory?myqueryhash Output should be: myqueryhash I am aware of this…
enloz
  • 5,363
  • 9
  • 33
  • 53
1
2 3
99 100