title: jqGrid Ajax validation inside beforeSubmit
body: <p>I have a jqGrid form for creating new users and what i want is to ensure that (among the other fields submitted by the form) the username does not already exist in the database.<br>
  So i created a beforeSubmit action, that is executed when the submit button is pressed but before the form is submitted.<br>
  I think the function works, because the code bellow always returns "User exists";</p>
  
  <blockquote>
    <p>beforeSubmit:function(postdata,formid) { return[false,"User exist"]; }</p>
  </blockquote>
  
  <p>But when i try ti use the $.get to make an ajax request to the server in order to see if the username already exists, i always get a <code>k is undefined</code> error. This is the code the produces the error  </p>
  
  <blockquote>
    <p>beforeSubmit:function(postdata,formid) {  </p>
    
    <p>$.get("project-management?r=Users/usernameExists&amp;tmpl=json&amp;username="
    + postdata.username, function(data) {<br>
     return[false,"Exists"];<br>
    }); }  </p>
  </blockquote>
  
  <p>I know that this is not a real validation but shouldn't produce the same result as the first script?  </p>
  
  <p>Thanks a lot</p>