title: Success callback function JQUERY AJAX not working
body: <p>I am trying to fetch password from database when username is provided .I am getting the result in POSTMAN, but the success callback function is not getting fired, even the error callback is also not working</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
  &lt;head runat=&quot;server&quot;&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script src=&quot;jquery/jquery-3.5.1.min.js&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;jquery/getpassword.js&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;
            &lt;div&gt;
              
              &lt;asp:TextBox ID=&quot;dirtext&quot; runat=&quot;server&quot; &gt;&lt;/asp:TextBox&gt;
              &lt;asp:Button ID=&quot;dirsubmit&quot; runat=&quot;server&quot; Text=&quot;Button&quot; OnClick=&quot;dirsubmit_Click&quot; /&gt;
             
  
                &lt;br /&gt;
                &lt;br /&gt;
                &lt;asp:Label ID=&quot;Label1&quot; runat=&quot;server&quot; Text=&quot;Label&quot;&gt;&lt;/asp:Label&gt;
             
  
          &lt;/div&gt; 
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>Given below the javascript file getpassword</p>
  <pre><code>$(document).ready(function () {
    $('#dirsubmit').click(function () {
          var x;
          var objuser = {
              name: $('#dirtext').val(),
              
          };
  
          var param = {
              user: objuser
          };
  
          $.ajax({
              type: &quot;POST&quot;,
              url: &quot;WebForm4.aspx/GetPassList1&quot;,
              data: JSON.stringify(param),
              contentType: &quot;application/json; charset=utf-8&quot;,
              dataType: &quot;json&quot;,
              success: function (response) {
                  alert(&quot;Hi&quot;);
                  console.log(response);
                  var result = JSON.parse(response.d);
                  x = result;
                  
  
              },
              error: function (response) {
                  console.log(&quot;error&quot;);
              }
          });
          console.log(x);
  
      });
     
  });
  </code></pre>
  <p>Given below is the function GETPASSLIST1</p>
  <pre><code>[System.Web.Services.WebMethod]
          public static string GetPassList1(User user)
          {
  
  
              using (var db = new userdetailsDBContext())
              {
  
               
                  var queryStud = db.UserDetails.Where(s =&gt; s.name == user.name)
                                                .Select(s =&gt; new { s.pass });
                 return JsonConvert.SerializeObject(queryStud);
                  
  
  
  
              }
          }
  </code></pre>
  <p>This is the result I got on postman which indicates that api is working fine still the success or the error callback is not getting fired</p>
  <pre><code>{
      &quot;d&quot;: &quot;[{\&quot;pass\&quot;:\&quot;$2a$11$iUGNxBof.6eka5XXSg7M1OR7sxy/enYK7wzF7TlSaaoJulxNcP0Um\&quot;}]&quot;
  }
  </code></pre>
  <p>If I remove .click event then the success callback is working but after using .click event it doesn't work</p>