-2

Any idea why this query string comes out like the one below?

var requestData = $('#txtCity').val() + ',' + $('#txtCountry').val() + '&APPID=e142d6277e3108bf30a12ab09c98ce6f';

http://api.openweathermap.org/data/2.5/weather?q=London%2CUK%26APPID%3De142d6277e3108bf30a12ab09c98ce6f

where txtCity is London and txtCountry is UK?

Lewis Smith
  • 1,271
  • 1
  • 14
  • 39

1 Answers1

2

This is URL Encoded. Certain characters will be encoded/escaped to a % followed by 2 hex characters as these have special meaning in a URL string. The following can be found in your string

%2C is a comma (,)
%26 is an ampersand (&)
%3D is an equal sign (=)
neelsg
  • 4,802
  • 5
  • 34
  • 58