title: Failed to load resource: the server responded with a status of 500 using Ajax
body: <p>I know this question has been asked previously, but I cannot find out what is the exact problem with my code.</p>
  
  <pre><code>function viewcalldetails(obj) {
                  alert("clicked");
                  var id = $(obj).attr("id");
                  $(".style-table-tab input[type='text']").val('');
                  setTimeout(function () {
                      $('.preloader-circle').show();// or fade, css display however you'd like.
                  }, 1000);
                  $.ajax({
                      type: 'POST',
                      url: pageUrl+"/LoadCallDetails",
                      data: '{LeadID: "' + id + '"}',
                      contentType: "application/json; charset=utf-8",
                      dataType: 'json',
                      success: OnValuecall,
                      failure: function (response) {
                          alert(response.d);
                      }
                  });
              }
  
  
              function OnValuecall(response) {
                  $(".preloader-circle").hide();
                  $("#ctl00_ContentPlaceHolder1_lbrfullname").text(response.d.FirstName);
                  $("#ctl00_ContentPlaceHolder1_lbrphonenumber").text(response.d.MobileNo);
                  $("#ctl00_ContentPlaceHolder1_lbraddress").text(response.d.Address1);
                  $("#ctl00_ContentPlaceHolder1_lbrorganization").text(response.d.OrganizationName);
                  $("#ctl00_ContentPlaceHolder1_lblremail").text(response.d.PrimaryEmail);
  
              }
  </code></pre>
  
  <p>Web Method:</p>
  
  <pre><code>public static UserAjax3 LoadCallDetails(string LeadID)
      {
          //System.Threading.Thread.Sleep(3000);
          UserAjax3 oUserAjax = new UserAjax3();
  
          //BD_CommonEmail[] ocall = BD_CommonEmail.GetEmailAll(Convert.ToInt32(LeadID)).ToArray();
          BD_Leads[] ocall = BD_Leads.getCallDetails(Convert.ToInt32(LeadID)).ToArray();
          if (ocall.Length == 1)
          {
              //   oUserAjax.LeadID = oLeads.LeadID.ToString();
              oUserAjax.LeadID = ocall[0].LeadID.ToString();
              oUserAjax.FirstName = ocall[0].FirstName;
              oUserAjax.MobileNo = ocall[0].MobileNo;
              oUserAjax.OrganizationName = ocall[0].OrganizationName;
              oUserAjax.Address1 = ocall[0].Address1;
              oUserAjax.PrimaryEmail = ocall[0].PrimaryEmail;
          }
          return oUserAjax;
  </code></pre>