locked
after alert message open new window RRS feed

  • Question

  • User-807418713 posted

    Hello

    this is my code

      $("#Button2").click(function () {
    
                     $.ajax({
                        type: 'POST',
                        contentType: "application/json; charset=utf-8",
                         url: 'Req_Internal.aspx/InsertData',
                         data: JSON.stringify({myModels:data}),                   
                         success: function (e) {
                             alert("Record Saved Sucessfully...");
                             location.reload(true);
                        },
                        error: function (e) {
                            alert("Error In Page Please Contact Admin...");
                        }
                        
                    }); 
            })         
            });    

    on button click after alert messafe record saved sucessfully I want to refresh current page and open new tab default4.aspx

    how to do so

    Thursday, March 11, 2021 8:21 AM

Answers

  • User1535942433 posted

    Hi Gopi.MCA,

    As far as I think,you could do done() after ajax.Otherwise,it will be blocked.

        <script>
            $(function () {
                $("#Button2").click(function () {
                    $.ajax({
                        type: 'POST',
                        contentType: "application/json; charset=utf-8",
                        url: '2175026.aspx/InsertData',
                        async: false,
                        dataType: "json",
                        success: function (e) {
                            alert("Record Saved Sucessfully...");
                        },
                        error: function (e) {
                            alert("Error In Page Please Contact Admin...");
                        }
                    }).done(function () {
                        window.open("2175034.aspx", "_blank"); 
                        window.location.reload();
                    })
                });
            })
        </script>

    Best regards,

    Yijing Sun

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 12, 2021 6:47 AM

All replies

  • User1535942433 posted

    Hi Gopi.MCA,

    As far as I think,you could do done() after ajax.Otherwise,it will be blocked.

        <script>
            $(function () {
                $("#Button2").click(function () {
                    $.ajax({
                        type: 'POST',
                        contentType: "application/json; charset=utf-8",
                        url: '2175026.aspx/InsertData',
                        async: false,
                        dataType: "json",
                        success: function (e) {
                            alert("Record Saved Sucessfully...");
                        },
                        error: function (e) {
                            alert("Error In Page Please Contact Admin...");
                        }
                    }).done(function () {
                        window.open("2175034.aspx", "_blank"); 
                        window.location.reload();
                    })
                });
            })
        </script>

    Best regards,

    Yijing Sun

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 12, 2021 6:47 AM
  • User2012850765 posted

    Thank you for solve!

    Saturday, March 20, 2021 5:11 AM