Search code examples
c#webmethod

WebMethod and retrieving values to populate a popup


I have the following function (Jquery) which call a WebMethod

         $(function () {
            $('.view-details').click(function (e) {
            e.preventDefault();

            $('#ticket-id').text("Ticket id: " + $(this).closest('tr').children().eq(1).html());

            $.ajax({

                type: "POST",

                url: "Default.aspx/PopulatePopUp",

                cache: false,

                data: "{'arg':'" +$(this).closest('tr').children().eq(1).html()+"'}",

                    contentType: "application/json; charset=utf-8",

            dataType: "json",

            success: function (msg)
            {
                alert(msg.d);

            }

        });

The WebMethod, calls out to a database, and gets a string using a SqlDataReader. Basically, i need to now populate a text box in a popup from the returned value. However, the alert displays undefined.


Solution

  • Sorted this, there was an issues with my prodcedure.