title: Passing a variable to URL parameters using JQuery POST
body: <p>I have a function which currently passes an account code (derived from a combo box) to the server.  Currently it does this by sending the request in the body - I need it to send as a URL parameter.  So for example the URL should be:</p>
  
  <pre><code>localhost:1234/myProject/WebApp/Data?accountCode=Full
  </code></pre>
  
  <p>Assuming full is selected.</p>
  
  <p>My code below works as a request body but my attempts to amend it to submit as a URL request have failed.  </p>
  
  <pre><code> accountSelected: function () {
                  var saccountCode = $("select#accountcombo").val();
                  var stringAccountCode = saccountCode.toString()
                  console.log("Account is: " + stringAccountCode);
                  var myURL = "WebApp/Data";
                  $.ajax({
                      url: myURL,
                      type: "POST",
                      data: {
                          "accountCode": stringAccountCode
                      },
                      dataType: "text",
                  })
  </code></pre>
  
  <p>I have been looking at using $.param but couldn't get anything to work and also read on other questions about using <code>$.get</code> but when I change my code above to a <code>"GET"</code> i get an error
  <code>"Request method 'GET' not supported"</code> - the server is expecting a POST request.  Any way i could achieve this?</p>
  
  <p>Thanks</p>