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 7368163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:37:50+00:00 2026-05-29T03:37:50+00:00

I have created a page which is autorefreshing via ajax requests. On this page

  • 0

I have created a page which is autorefreshing via ajax requests. On this page there is a lot of modal dialog-boxes.

My problem is, that the first the time page is loaded, all works perfect. But when it is refreshed via ajax the dialog-boxes disregards autoOpen: false and modal: true. I have no idea why?! 🙁

My start JS code:

var intval;
var xmlhttp;
$('.ui-dialog').dialog({
    open: function(event, ui) {
        stopTimer();
    },
    close: function(event, ui) {
        startTimer();
    }
});

function startTimer() {
    intval = setInterval('ajaxRefresh()', 15000);
};

function stopTimer() {
    clearTimeout(intval);
    if (xmlhttp) xmlhttp.abort();
};

function isDialogOpen() {
    var value = false;
    $('.ui-dialog').each(function() {
        if ($(this).dialog('isOpen') == true) value = true;
    });
    return value;
};

function ajaxRefresh() {
    xmlhttp = $.ajax({
        url: 'site.asp',
        data: {
            tab: 'hi',
            p: 's',
            a: 'open',
            c: 'some',
            h: 'thing'
        },
        beforeSend: function() {
            stopTimer();
            $('#timerimg').attr('src', 'img/icons/loading.gif');
        },
        error: function(xhr, thrownError) {
            if (xhr.status !== 0) alert(xhr.status + ' - ' + thrownError);
        },
        success: function(result) {
            if (!isDialogOpen()) $('body').html(result);
        },
        complete: function() {
            $('#timerimg').attr('src', 'img/icons/stop.gif');
        }
    })
};

$(document).ready(function() {
    startTimer();
});

During loading of the page in ASP the dialogs are created and looks like this:

$('#close1').dialog({
    modal: true,
    draggable: false,
    resizable: false,
    autoOpen: false,
    width: 400,
    buttons: {
        'close': {
            text: 'Nej',
            click: function() {
                $(this).dialog('close');
            }
        },
        'submit': {
            text: 'Ja',
            click: function() {
                window.location = 'page.asp?p=s&a=open&c=some&h=thing&n=close&id=1'
            }
        }
    }
});
$('#close1Opener').live('click', function() {
    $('#close1').dialog('open');
    return false;
});

How many dialogs that are created depends on the database inputs, so this is completely dynamic.

So: When the page refreshed on request by the timer, all the dialogs that are created again disregards autoOpen: false and modal: true …… draggable, resizable, width and buttons works still perfect.

What to do?

  • 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-29T03:37:51+00:00Added an answer on May 29, 2026 at 3:37 am

    See the jQuery Dialog documentation here.

    One thing you might try is using $('#close1').dialog('destroy'); which brings the dialog back to it’s pre-initialized state.

    Also using .live() probably isn’t necessary and should be avoided if possible. Using $('#close1Opener').click(function () {}); is a cleaner way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a HTML page which uses Calibri font. Now this font is
I have page which created dynamically. Now I want to add ajax function, so
I have created a login page which authenticates a user via the atuthentication class.
I have created a JSF 2 page which uses Facelets to define the structure
I have a page which contains a jQuery-UI horizontal slider, created using a little
I have a module in which I created a custom page with controller and
I have a page with a UserControl (in which linkbuttons are dynamically created). On
I have page named page--news.tpl.php, which i created for my news page. But after
I have created a jsp page which run fine when executed in tomcat.But when
I have created a HTML error page which has a button with text Try

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.