locked
after alert message page should be referesh RRS feed

  • Question

  • User-807418713 posted

    Hello

    I'm using this script on my page

    <script type="text/javascript">
            var data = [];
            $(document).ready(function () {
                $('#txtQuantity').blur(function (e) {
                    var ItemName = $('#txtName').val();
                    var Rate = $('#txtRate').val();
                    var Quantity = $('#txtQuantity').val
                    var item = {
                        ItemName: $('#txtName').val(),
                        Rate: $('#txtRate').val(),
                        Quantity: $('#txtQuantity').val(),
                        
                    };
                    data.push(item);
                    item.index = data.length -1;
                    $("#GridView1 tbody").append("<tr data-index='" + (data.length-1) + "'><td>" + $('#txtName option:selected').text() + "</td><td>" + $('#txtRate').val() + "</td><td>" + $('#txtQuantity').val() + "</td>" + "<td><input type='button' value='Delete' /></td>" + "</tr>")
    
                    $("#GridView1 tbody tr:last input").click(function () {
                       
                        $(this).parent("td").parent("tr").remove();
                        var index = $(this).parent("td").parent("tr").data("index");
                        data = data.filter(function (ele) {
                           
                            if (ele.index == index) {
                                return false;
                            }
                            return true;
                        })                                
                    })
    
                    $('#txtName option:first').prop("selected",true);
                    $('#txtRate').val("");
                    $('#txtQuantity').val("");
                });
    
                $("#Button1").click(function () {
    
                     $.ajax({
                        type: 'POST',
                        contentType: "application/json; charset=utf-8",
                         url: 'WebForm5555.aspx/Insert_Data',
                         data: JSON.stringify({myModels:data}),                   
                         success: function (e) {
                             alert("success")
                        }
                        
                    }); 
            })         
            });    
        </script>

    After Alert Message If i click okay then page should be refresh

    how to do so

    Friday, June 7, 2019 6:30 AM

Answers