title: How to consume the return value of a webservice in jquery ajax call?
body: <p>I have a simple webservice in asp.net which determine if the input parameter is valid or not : </p>
  
  <pre><code>[WebMethod]
  public bool IsValidNationalCode(string input)
  {
      return input.IsNationalCode();
  }
  </code></pre>
  
  <p>I call it from an aspx page by jquery ajax function : </p>
  
  <pre><code> $('#txtNationalCode').focusout(function () {
        var webMethod = "../PMWebService.asmx/IsValidNationalCode";
        var param = $('#txtNationalCode').val();
        var parameters = "{input:" + param + "}";
  
        $.ajax({
            type: "POST",
            url: webMethod,
            data: parameters,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg) {
                if(msg.responseText == true)
                    $('#status').html("Valid");
                else {
                    $('#status').html("Invalid");
                }
            },
            error: function () {
                $('#status').html("error occured");
            }
       });
   });
  </code></pre>
  
  <p>But I don't know how to get the return value of webservice in order to show appropriate message . Here <code>if(msg.responseText == true)</code> doesn't work </p>