Ajax Script calling APIs

   <script type="text/javascript">
        var table = $("#tablee");
        var http = "http://192.168.0.112/service.asmx/";
        var ddl = $(".ddllist");
        var uol = $("#unolst");
        $(document).ready(function () {
            Bind();
            Dropdown();
        });
        function Bind() {
            $.ajax({
                url: http+'ListofEmail',
                method: 'post',
                dataType: 'json',
                success: function (data) {
                    $.each(data, function (idx, elem) {
                        table.append("<tr><td>" + elem.HOST_EMAIL_ID + "</td><td>" + elem.HOST_PWD + "</td></tr>");
                    });
                },
                error: function (err) {
                    alert(err);
                }
            });
        }


        function Dropdown() {
            $.ajax({
                url: http + 'ListofEmail',
                method: 'post',
                dataType: 'json',
                success: function (data) {
                    ddl.append($('<option/>', { value: -1, text: 'Select Mail' }));
                    $(data).each(function (index, item) {
                        ddl.append($('<option/>', { value: item.HOST_EMAIL_ID, text: item.HOST_PWD }));
                    });
                },
                error: function (err) {
                    alert(err);
                }
            });


            $.ajax({
                url: http + 'ListofEmail',
                method: 'post',
                dataType: 'json',
                success: function (data) {
                    $.each(data, function (idx, elem) {
                        uol.append("<li>" + elem.HOST_EMAIL_ID + "</li><li>" + elem.HOST_PWD + "</li>");
                    });
                },
                error: function (err) {
                    alert(err);
                }
            });
        }

    </script>

Comments

Post a Comment

Popular posts from this blog

Automatically send Birthday email using C#.Net

Drag and Drop multiple File upload using jQuery AJAX in ASP.Net using C# and VB.Net

Difference between each and map in jquery