2016-11-08 172 views
-1

我很清楚以前問過這個問題。但我無法找出什麼是我的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 –

回答

3

有問題的東西:

  1. 「pageUrl」來自哪裏?
  2. 您正在等待JSON結果,但您的方法似乎會返回一個普通對象。你在哪裏轉換爲JSON?
  3. 你是否嘗試在單步模式下使用調試器運行你的web方法?
  4. 爲什麼你的web方法是靜態的?
+0

讓我猜 - 這是錯誤的pageUrl?!因爲如果你的斷點沒有被擊中,那麼你的呼叫地址可能是錯誤的。 – Tom

相關問題