Pradeep Rawat

Pradeep Rawat

  • NA
  • 286
  • 8.3k

how to call javscript function from code behind

Jul 24 2021 5:45 AM

i want to call the javascript function from the code behind until the javascript function process is not completed. should not come back to the code-behind.

below is my code-after getting the resposne from api now need to add value into table and dispaly

var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
all = JsonConvert.DeserializeObject<Allorders>(responseString);
ScriptManager.RegisterStartupScript(this, typeof(Page), "OnClientClicking", "divCloseAcntopen();", true);
GetAllOrders();
IdOfOrder=all.id;
GetordedsdsdsrById(IdOfOrder);

javascript function

<script>
function divCloseAcntopen {
       $('#tbodyid').empty();
         $.ajax({
           method: "POST",
           url: "Defaulta.aspx/GetAllOrderss",   
           contentType: "application/json; charset=utf-8",
           dataType: "json",
           success: function (response)
           {
               for (var k = 0; k < 6; k++)
               {
                //$('#tblEmployee').append('<tr> <td>' + response.d[1].id + '</td>  <td>' + response.d[1].status + '</td> <td>' + response.d[1].side + '</td></tr>');
                 }

         },
           error: function (response) {
               console.log("error")
               console.log(response)
           }
       })
       }
</script>

 


Answers (3)