title: Django server side AJAX validation
body: <p>Recently I'm trying to implement a simple Django application that include one server side AJAX validation, it's a simple form input field (username). I have used a pre-built in line AJAX validation library which uses jQuery. So the code goes like this</p>
  
  <p><strong>HTML snippet</strong></p>
  
  <pre><code>&lt;form id="simpleform" method="post" action="/done/"&gt;
  
  Username:&lt;input value="" class="validate[required,custom[noSpecialCaracters],length[0,20],ajax[ajaxUser]]" type="text" name="user" id="user" /&gt;
  
  &lt;input class="submit" type="submit" value="Validate"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>The server side code snippet (embedded in to a php script)</strong>
      
  
  <pre><code>/* RECEIVE VALUE */
  $validateValue=$_POST['validateValue'];
  $validateId=$_POST['validateId'];
  $validateError=$_POST['validateError'];
  
      /* RETURN VALUE */
      $arrayToJs = array();
      $arrayToJs[0] = $validateId;
      $arrayToJs[1] = $validateError;
  
  if($validateValue =="testname"){        // validate??
      $arrayToJs[2] = "true";         // RETURN TRUE
      echo '{"jsonValidateReturn":'.json_encode($arrayToJs).'}';          // RETURN ARRAY WITH success
  }else{
      for($x=0;$x&lt;1000000;$x++){
          if($x == 990000){
              $arrayToJs[2] = "false";
              echo '{"jsonValidateReturn":'.json_encode($arrayToJs).'}';      // RETURN ARRAY WITH ERROR
          }
      }
  
  }
  </code></pre>
  
  <p>So my question is that how do I get this in to Python code (in order to use in Django environment) how do I get the user name from the input field in to the back end,I think the server side script snippet already does it but I want to know how to use this in my Pyhon code,and this is my first time using jQuery and I do need to use this same exact validation library. Your valuable corporation is needed.</p>
  
  <p>Thanks.</p>