Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7583151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:36:49+00:00 2026-05-30T18:36:49+00:00

I am using JQuery Mobile for an application. While it is a great framework,

  • 0

I am using JQuery Mobile for an application. While it is a great framework, there are some nuances that I’m learning about. Currently, I have a two page application. When a user navigates to a the second page, I interact with a web service. If the web service returns a success, I load the second page. If the web service returns a failed message, I want to show them a dialog with a prompt. To do that, I’m currently doing the following:

my.js

$("#page2").live("pageshow", function () {
  var isGood = getResult();
  if (isGood == false) {
    $.mobile.changePage("/myDialog", { role: "dialog" });
  }
  else {
    // Continue loading page2 related information
  }
}); 

Currently, this logic works almost as I need. The dialog appears. However, when I close it, the “pageshow” event for “page2” fires again. Thus, loading the dialog again. Essentially, I have an infinite loop. I’m not sure how to get around this. It almost like a dialog is loaded into the DOM completely on its own instead of in relation to the page. Because of that, I’m not sure how to respond to dialog events or interact with it. How do I get around this?

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:36:50+00:00Added an answer on May 30, 2026 at 6:36 pm

    I’m not sure if this is the best way to do this, but it should work:

    var dialogShown = false;
    
    $("#page2").live("pageshow", function () {
      if(dialogShown)
        return;
      var isGood = getResult();
      if (isGood == false) {
        $.mobile.changePage("/myDialog", { role: "dialog" });
        dialogShown = true;
      }
      else {
        // Continue loading page2 related information
      }
    }); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jQuery Mobile for my application that runs mainly on desktop browsers. The
I am using jquery mobile in iPhone application, I have included the resources files
Created a phonegap application using jQuery Mobile. Everything is working great for the most
I am developing a mobile application using phonegap and jquery mobile. I have this
I am using jQuery Mobile in my web application. There is a datepicker which
I made an application using jQuery mobile, but now I have a huge problem.
I am developing the application using jQuery Mobile 4.1. In my app, I have
I'm currently making a jQuery Mobile application and using Phone Gap to deploy to
I am using Jquery Mobile framework for developing cross-browser Application. I am also planning
Working on a mobile application using jquery mobile and phonegap framework. My question is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.