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

5108 questions
2694
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,614
  • 20
  • 73
  • 104
1560
votes
26 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
  • 29,384
  • 41
  • 99
  • 151
1502
votes
16 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
  • 28,537
  • 15
  • 60
  • 73
782
votes
34 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
  • 17,133
  • 33
  • 112
  • 192
713
votes
48 answers

Query-string encoding of a JavaScript object

Is there 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
  • 15,574
  • 9
  • 51
  • 70
683
votes
3 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
  • 27,513
  • 23
  • 77
  • 91
680
votes
10 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
  • 45,281
  • 39
  • 129
  • 237
627
votes
13 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
  • 75,446
  • 119
  • 278
  • 425
614
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
  • 30,235
  • 44
  • 126
  • 216
594
votes
40 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
  • 25,331
  • 21
  • 69
  • 77
569
votes
12 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
  • 173,523
  • 149
  • 402
  • 512
535
votes
13 answers

How can I get query parameters from a URL in Vue.js?

How can I fetch query parameters in Vue.js? E.g. http://somesite.com?test=yay Can’t find a way to fetch or do I need to use pure JS or some library for this?
Rob
  • 10,851
  • 21
  • 69
  • 109
493
votes
37 answers

Adding a parameter to the URL with JavaScript

In a web application that makes use of AJAX calls, I need to submit a request but add a parameter to the end of the URL, for example: Original URL: http://server/myapp.php?id=10 Resulting URL: http://server/myapp.php?id=10&enabled=true Looking…
Lessan Vaezi
  • 6,927
  • 3
  • 25
  • 15
475
votes
30 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
  • 43,371
  • 65
  • 192
  • 320
429
votes
4 answers

How to get a URL parameter in Express?

I am facing an issue on getting the value of tagid from my URL: localhost:8888/p?tagid=1234. Help me out to correct my controller code. I am not able to get the tagid value. My code is as follows: app.js: var express = require('express'), http =…
user2834795
  • 4,333
  • 2
  • 15
  • 10
1
2 3
99 100