Search code examples
javascriptjqueryajaxjsonwebmethod

Not able to fetch data/Response on Success of Jquery.Ajax()


Hi people, I am craving myself from past 3 days and I just couldn't find the way to access json response seen on my browser

Json response seen on firebug

Here is my Ajax code :

$("[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);
        }
    });
});

Please help me on this.. Thanks in Advance!


Solution

  • I see that your JSON is an array with an object. Try data[0].Leadno