wait for the server side asyncpostbacktrigger to finish before continuing on javascript callback RRS feed

  • Question

  • User-153404742 posted

    so I have the following code:

     callback: function (result) {
                                if (result) {
                                    switch (action) {
                                        case "move":
                                            document.getElementById('<%= btnTrigger.ClientID%>').click();

                                            console.log("Moved file");

    what's happening is that btnTrigger click even takes a few seconds to complete and the last step in that action is resetting the jsonString ojbect.  However, btnTrigger is an asyncpostback trigger event so JSON.parse('<%=jsonString%>') data is still from the old jsonString object.  Is there a way to await the btnTrigger to complete before performing JSON.parse on the jsonString object?

    Friday, October 23, 2020 10:35 PM

All replies

  • User-474980206 posted

    The click reloads the page, but your log in runs on the old page. Remove the JavaScript code, and render it on the new post back page as client script.

    I see from the previous post, it an Update form post. You will need the update panel to rerender the json string. you can hook up a client event to update panel complete to run the code. See docs

    Friday, October 23, 2020 11:56 PM