title: jQuery validation remote with symfony 2 url routing
body: <p>I'm rewriting some javascript validation using <a href="http://jqueryvalidation.org/" rel="nofollow">jQuery Validate plugin</a></p>
  
  <p>One problem that has occurred is with a function that checks if the username is valid or not.
  It does this by sending an ajax call containing the username.</p>
  
  <p>The request URL needs to look like this:</p>
  
  <blockquote>
    <p>/ajax/check-username/usernamehere</p>
  </blockquote>
  
  <p><strong>Current function:</strong></p>
  
  <pre><code>var checkUsername = function(value){
      var username = false;
      jQuery.ajax({
          url: "/ajax/check-username/" + encodeURI(value)
      }).done(function (data) {
          if (data.exists) {
              username = false;
          } else {
              username = true;
          }
      });
      return username;
  }
  </code></pre>
  
  <p>jQuery Validate request path looks like this:</p>
  
  <blockquote>
    <p>/ajax/check-username/?username=usernamehere</p>
  </blockquote>
  
  <p><strong>jQuery Validation:</strong></p>
  
  <pre><code>jQuery('#user').validate({
      rules: {
          username: {
              required: true,
              minlength: 6,
              remote: {
                  url: '/ajax/check-username/'
              }
          }
      }
  });
  </code></pre>
  
  <p>How can I get the remote method to use my current url routing?</p>