English subtitles

← Query Parameters - Web Development

Get Embed Code
3 Languages

Showing Revision 4 created 05/25/2016 by Udacity Robot.

  1. Okay. Let's add something new to our URLs called a
  2. query parameter, also known as get parameters, and we'll talk
  3. about this name shortly, when we start talking about HTTP.
  4. Here is an example. We've got our normal URL or the
  5. type of, the simple URL we just discussed, with a,
  6. a simple path slash foo and we've added to the
  7. end of this a question mark p equals one. And
  8. this adds an actual, extra parameter whose name is P and
  9. whose value is one. The format of a query parameter looks
  10. like this. You've got name equals value, or in this case
  11. P equals 1. And the value can be just about anything,
  12. but it's good not to use question marks and other URL
  13. characters, although you could if you really wanted. We can make
  14. this a little bit more complicated by adding more query parameters.
  15. Let's do that. We've added a second query parameter. The first
  16. query parameter is separated from the UR, URL using a, question
  17. mark. All of the following parameters are separated from each other
  18. using ampersands. First one gets a question mark. The next one
  19. gets an ampersand. In this case, the new parameter is Q,
  20. and it equals the string neat. So, we have these query
  21. parameters. What are they for? They're for basically, when you, when
  22. you make a request for this path, this is extra information
  23. the server gets, and there's all sorts of things you can
  24. do with this. If this is a, a web application doing fancy
  25. things these parameters might mean something. It can affect the
  26. caching because technically it changes the entire URL. So there
  27. are all sorts of handy uses that we'll discuss later
  28. in the class for what these query parameters can do. But
  29. they are separate from the path. But they are included
  30. in part of the whole URL that the server sees
  31. when you make a request. In the following URL, what
  32. is the value of the Z parameter? Here is your URL.