3
Answers

Nested Ajax Function Call Webservice

Arshad Ali

Arshad Ali

9y
372
1
         
      Good After Noon Sir,
                                                 Sir i am created one webMethod to read data for the data reader and i call to ajax function but not received or get my product id form the data reader. code is following. i am try to call this webmethod Nested ajax function but not get output please help me.
 Thanks you....
 
 
 SqlConnection SqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["eLabSysCstr"].ToString());
SqlCommand ocmd = new SqlCommand("pr_get_products", SqlConn);
try
{
            ocmd.CommandType = "select * from product";   
            ocmd.Connection.Open();
            SqlDataReader odr = ocmd.ExecuteReader();
            if (odr.Read())
            {
                  txtItemCode.Text = odr["product_code"].ToString();
            }
 
var _id = $('#HFProductId').val();;
$.ajax(
{
type: "POST",
contentType: "application/json; charset=utf-8",
url: "EntryForm.aspx/insertData",
data: {},
dataType: "json",
success: function (data)
{
         function getid(prod_id)
         {
               $.ajax({
               type: "POST",
               url: "EntryForm.aspx/GetDetails",
               data: "{ 'Product_Id': '" + prod_id + "'}",
               contentType: "application/json; charset=utf-8",
               dataType: "json",
               success: function (response)
               {
                  // BindTable(response.d);
                  console.log(prod_id);   
                 },
                  failure: function (msg)
               {
                     // alert(msg);
               }
});
}
 
Answers (3)