How to get values out of Ajax success data function

How to get values out of Ajax success data function

My Ajax data function has data but I can't figure out how to get that data out and insert it into a textbox with the ID of FirstName. I know the data is there because I can debug and see "d" contains all of the data from my query but how do I extract it from the success function?

My Ajax data function has data but I can't figure out how to get that data out and insert it into a textbox with the ID of FirstName. I know the data is there because I can debug and see "d" contains all of the data from my query but how do I extract it from the success function?

$(document).ready(function () {
$("#btnGetData").click(function () {        
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: "Default.aspx/GetFormData", //Default.aspx is page and GetFormData is the WebMethod  
        data: {},
        dataType: "json",
        success: function (data) {
            data: { ("#FirstName").val(d.FirstName) }            
        },            
        error: function () {
            alert("Error while Showing update data");
        }
    });
});
});

WebMethod:

public static List<MembersClass> GetFormData()
{

List&lt;MembersClass&gt; infoObjs = new List&lt;MembersClass&gt;();
try
{
    // Initialization.
    string cs = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

    using (SqlConnection con = new SqlConnection(cs))
    {
        SqlCommand cmd = new SqlCommand("dbo.spGetMemberbyMemberID", con);
        cmd.Parameters.AddWithValue("@MemberID", "123");
        cmd.CommandType = CommandType.StoredProcedure;
        con.Open();
        SqlDataReader rdr = cmd.ExecuteReader();

        // Read file.
        while (rdr.Read())
        {
            MembersClass infoObj = new MembersClass();
            infoObj.FirstName = rdr["first_name"].ToString();
            infoObj.LastName = rdr["last_name"].ToString();

            // Adding.
            infoObjs.Add(infoObj);

        }
    }
}
catch (Exception ex)
{
    Console.Write(ex);
}

// info.
return infoObjs;

}


asp.net ajax

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Hire ASP.Net Developers

Looking to outsource your asp dot net development requirement? ASP.Net is a special feature of the DOT Net framework created by Microsoft. At [HourlyDeveloper.io](https://hourlydeveloper.io/ "HourlyDeveloper.io"), we have a team of experienced...

Routing in MVC - ASP.NET Core Demystified

ASP.NET Core MVC has introduced quite a few concepts that new (or new-to-ASP.NET) web developers might have some difficulty getting caught up with. My ASP.NET Core Demystified series is designed to help these developers get started building their own custom, full-fledged, working AASP.NET Core applications. In

What is the ASP.Net Machine Account on my Computer?

Some users have reported the existence of the ASP.Net machine account. In this article, I will discuss what is asp.net machine account in windows 10/7 and how to disable it, asp.net machine account password, and can I delete asp.net machine account? .NET Framework is an application on Windows that requires the installation to run several apps or games. However, when the .NET Framework is downloaded and installed, the application automatically creates an ASP NET machine account.

ASP.NET MVC Application with JQuery, AJAX

Let's have a sample example: We have a submit button in our JQuery AJAX MVC application. Let's try to show a message when it is clicked. ASP.NET MVC Application - Using JQuery, AJAX

ASP.NET Community Standup - ASP.NET Core Linker with David Fowler

David Fowler will be showing ASP.NET Core linker improvements on the way for .NET 5, and probably some other crazy experiments. Come join the fun! Community ...