title: Getting issue while doing validation using jQuery with JSON call
body: <p>I have one text box in View in MVC and I have to validate this text box client side before submit.I'm using jquery for validation as following:</p>
  
  <pre><code>$("input[type='submit']").click(function () {
              //validation at client side
              //------------------Code 1-------------------
              if ($("#txtName").val() == "") {
                  alert("Please enter Name.");
                  return false;
              }
              //------------------Code 1-------------------
              //------------------Code 2-------------------
              //call to database for validation
              $.getJSON("/Producy/IsExist?productname=toy", function (data) {
                  if (data.IsExists == "1") {
                      alert("Product already exist.");
                      return false;
                  }
              });
              //------------------Code 2-------------------
  
          });
  </code></pre>
  
  <p>Validation working properly only with <strong>Code 1</strong> not with <strong>Code 2</strong>
  When I click on submit message display "Product already exist" but form get posted even I wrote <code>return false</code> after alert message.Why it's doing such type of behavior.</p>
  
  <p>Thanks.</p>