title: jQuery & AJAX to check if email exist in database on focusout doesn't work
body: <p>What I'm trying to do is simple; I just want to check if an email address is already in database when I focusout this input text. &amp; so, get a success/error message.</p>
  <p>But nothing appears, even when I'm trying to write an email address which is already in database</p>
  <p>So I have this jQuery function:</p>
  <pre class="lang-js prettyprint-override"><code>jQuery('#txt-mail-0').bind(&quot;focusout&quot;, function () {
      $.ajax({
          method: &quot;POST&quot;,
          url: '@Url.Action(&quot;CheckEmailOfWorkflow&quot;)',
          data: { idWorkflow: clientInformation.idWorkflow, email: jQuery(this).val() },
          async: false,
          dataType: 'json',
          success: function (data) {
              if (data.result) {
                  //ALREADY IN BASE = ERROR
                  successGeneral.hide();
                  successTxtEmail.hide();
                  errorGeneral.show();
                  errorTxtEmail.show();
  
                  jQuery(this).removeClass(&quot;is - valid &quot;);
                  jQuery(this).removeClass(&quot;is - invalid &quot;);
  
                  jQuery(&quot;#btn-next-1&quot;).prop('disabled', true);
                  jQuery(this).addClass(&quot;is - invalid &quot;);
                  jQuery(this).css(&quot;background&quot;, &quot;#FAC8C8&quot;);
              }
              else {
                  //NOT IN BASE = SUCCESS
                  successGeneral.show();
                  successTxtEmail.show();
                  errorGeneral.hide();
                  errorTxtEmail.hide();
  
                  jQuery(this).removeClass(&quot;is - valid &quot;);
                  jQuery(this).removeClass(&quot;is - invalid &quot;);
  
                  jQuery(&quot;#btn-next-1&quot;).prop('disabled', false);
                  jQuery(this).addClass(&quot;is - valid &quot;);
                  jQuery(this).css(&quot;background&quot;, &quot;#E1E1E1&quot;);
              }
          }
      });
  });
  </code></pre>
  <p>Referring to this function in the Controller :</p>
  <pre class="lang-cs prettyprint-override"><code>[HttpPost]
  public JsonResult CheckEmailOfWorkflow(int idWorkflow, string email)
  {
      List &lt; Staging &gt; listeStaging = dataBase.getAllStagingByIdWorkflow(idWorkflow.ToString());
      foreach(Staging staging in listeStaging)
      {
          if (staging.Email == email) {
              return Json(true);
          }
      }
      return Json(false);
  }
  </code></pre>
  <p>&amp; finally, here's the DataAccess :</p>
  <pre class="lang-cs prettyprint-override"><code>public List &lt; Staging &gt; getAllStagingByIdWorkflow(string idWorkflow)
  {
      List &lt; Staging &gt; data = new List&lt;Staging&gt;();
      if (!string.IsNullOrEmpty(idWorkflow)) {
          try {
              data = _core.Fetch&lt;Staging&gt;(Sql.Builder.Where(&quot;ID_WORKFLOW=@0&quot;, idWorkflow));
          }
          catch (Exception) {
              return data;
          }
      }
      return data;
  }
  </code></pre>
  <p>Do you have any idea?</p>