changePage failure cripple AJAX calls

changePage failure cripple AJAX calls

I have a problem with JQM when a "changePage" failure occurs within an AJAX calls.  After JQM reports a "page load failed", all subsequent AJAX calls throws an error.  Here's the code:

        // Event when user click one of the function button
        $('.page_main_menu_role').on("click", function () {

            // submit the selected role to server
            $.ajax({
                type: "POST",
                url: "./SelectRole",
                data: { RoleID: this.getAttribute("roleid") },
                dataType: "json",
                async: false,
                cache: false,
                error: function (rqst, text, thrownError) {
                    // on error
                    ShowError(thrownError);
                },
                success: function (data) {
                    // on success
                    if (data.ReturnCode == "Success") {
                        // go to desired page
                        $.mobile.changePage(data.Detail, { reload: true });
                    }
                    // if user must confirm before jumping to other page
                    else if (data.ReturnCode == "Confirmation") {
                        // ask question
                        AreYouSure(data.Question, "Oui", "Non",
                            // if yes, then go to other page
                            function () {
                                $.mobile.changePage(data.Detail, { reload: true }); },
                            null);
                    }
                    else {
                        // show error
                        ShowError(data.Detail);
                    }
                }
            });

            return false;
        });

Here the explanation of the code: when the user clicks on a button, a call is made to the server.  The server then return the page where the application should go to (in case of success) and JQM goes to that page.

The problem occurs if an error occurs on the "changePage".  If the new page fails to load, an error message is displayed by JQM and the user remains on the current page.  Then, if the user clicks the button again, the AJAX calls automatically go to error callback.  No request is send to the server.  The only way to correct this is to restart the whole application.