2014-03-28 35 views
0

人喜的成功,數據/應答,我從過去3天內渴望我自己,我只是找不到訪問看到我的瀏覽器無法擷取上Jquery.Ajax()

JSON響應方式

Json response seen on firebug

這裏是我的Ajax代碼:

$("[id*=btnModalPopup]").live("click", function() { 

    $("#tblCustomers tbody tr").remove(); 

    $.ajax({ 
     type: "POST", 
     url: "CallDataThroughJquery.aspx/GetLeadDetails", 
     data: '{}', 
     contentType: "application/json; charset=utf-8", 
     dataType: "json", 
     success: function (data) { 
     alert("Hi Json"); 
     alert(data.Leadno); // **Says data.leadno is undefined** 

     response($.map(data.d, function (item) { // **here I am going some where wrong** 
     //**cannot catch response. Help!** 

     })) 

     }, 
     failure: function (response) { 
      alert(response.d); 
     } 
    }); 
}); 

請幫我在這..先謝謝了!

+0

可以自己信息的JSON過這裏 –

+0

這裏響應是JSON響應: [{ 「__type」: 「WEBFORMS_CallDataThroughJquery + LeadDetails」, 「Leadno」: 「HR30082009000227」, 「StatusName」 :「跟進」,「到期日」:4}] – KeVee

+0

您可以發佈回覆嗎? –

回答

1

我看到你的JSON是一個包含對象的數組。嘗試數據[0] .Leadno

0
$.ajax({ 
    type: "POST", 
    url: "CallDataThroughJquery.aspx/GetLeadDetails", 
    data: '{}', 
    contentType: "application/json; charset=utf-8", 
    dataType: "json", 
    success: function (data) { 
    alert("Hi Json"); 
    alert(data.d[0]['Leadno']); // **Says data.leadno is undefined** 

    response($.map(data.d, function (item) { // **here I am going some where wrong** 
    //**cannot catch response. Help!** 

    })) 

    }, 
    failure: function (response) { 
     alert(response.d); 
    } 
}); 

嘗試一下'data.d [0] ['Leadno']'。

+0

它實際上使用數據[0] .Leadno – KeVee

+0

@Angel,你可以用這種方法做到這一點。 – RGS