加载资源失败:使用Ajax响应状态为500的服务器

问题描述:

我很清楚以前问过这个问题。但我无法找出什么是我的code.Please确切的问题帮我理清这个问题加载资源失败:使用Ajax响应状态为500的服务器

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); 

      } 

Web方法:

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; 
+0

为什么不设置断点检查是否调用LoadCallDetails。如果不检查你的帖子的网址。 – Bucketcode

+0

我已经检查使用break point.But没有调用LoadcallDetails @CodeFarmer –

有问题的东西:

  1. “pageUrl”来自哪里?
  2. 您正在等待JSON结果,但您的方法似乎会返回一个普通对象。你在哪里转换为JSON?
  3. 你是否尝试在单步模式下使用调试器运行你的web方法?
  4. 为什么你的web方法是静态的?
+0

让我猜 - 这是错误的pageUrl?!因为如果你的断点没有被击中,那么你的呼叫地址可能是错误的。 – Tom