Sunday 23 December 2018

Get Data Through Ajax || Ajax with asp.net mvc in hindi/urdu





<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<script src="~/Scripts/jquery-1.10.2.js"></script>

<div class="container">



    <table class="table table-responsive table-striped">

        <thead>

            <tr>

                <th>ID</th>

                <th>NAME</th>

                <th>EMAIL</th>

                <th>ADDRESS</th>



            </tr>

        </thead>



        <tbody id="ListData">





        </tbody>



    </table>







</div>









<script>



    $(document).ready(function () {

        GetData();



        function GetData()

        {



            var html = '';



            $.ajax({



                type: 'GET',

                url: '/Home/GetAllEmployee',

                success: function (response)

                {



                    $.each(response, function (key, item)

                    {



                        html += "<tr> <td>" + item.Id + " <td>  <td>" + item.Name + " <td> <td>" + item.Email + " <td>  <td>" + item.Address + " <td></tr>";

                    });



                    $("#ListData").append(html);



                }



            });







        }













    });









</script>

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...