title: $.ajax & passing data to .asmx webservice
body: <p>I'm quite confused as to why this is happening.</p>
  
  <p>I can't seem to pass data successfully via <code>$.ajax</code>, the URL gets all mangled up instead of the data being passed in a query string.</p>
  
  <p><em><strong>I've cleaned up the code for brevity, see below.</em></strong></p>
  
  <p><strong>Webservice (using GET)</strong></p>
  
  <pre><code>[WebMethod]
  [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
  public string TestMethod(string country, string city)
  {
      return country + city;
  }
  </code></pre>
  
  <p><strong>jQuery</strong></p>
  
  <pre><code>$.ajax({
      url: "Test.asmx/TestMethod",
      type: "GET",
      data: '{"country":"' + country + '","city":"' + city + '"}',
      dataType: "json",
      success: function(msg) {
          alert(msg.d);
      }
  });
  </code></pre>
  
  <p><strong>Resulting URL and Error (in Firebug)</strong></p>
  
  <pre><code>http://example.com/Test.asmx/TestMethod?{%22country%22:%22NZ%22,%22city%22:%22AK%22}
  System.InvalidOperationException: Missing parameter: country.
  </code></pre>