无法加载资源:服务器使用Ajax

时间:2016-11-08 09:40:08

标签: javascript c# jquery asp.net ajax

我之前已经问过这个问题,但是我无法找出代码的确切问题。

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

            }

网络方法:

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;

1 个答案:

答案 0 :(得分:3)

有很多问题:

  1. " pageUrl"来自?
  2. 您正在等待JSON结果,但您的方法似乎返回了一个普通对象。你在哪里转换成JSON?
  3. 您是否尝试在网络方法中以单步模式运行调试器?
  4. 为什么您的网络方法是静态的?