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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:59:06+00:00 2026-06-14T00:59:06+00:00

I am writing an ajax call to a python backend which generates the HTML

  • 0

I am writing an ajax call to a python backend which generates the HTML for a modal dialog box and pops up said dialog box afterward. However, recently I’ve been having issues here. My code (thus far) is as follows for the JS frontend.

var deletegroup = function(group){
        $.ajax({
                url: "ajax.py/get_orphaned_networks",
                data: {group: group},
                success: function(result){
                        if (result == 0){
                                alert("Group does not contain networks, no networks will be deleted.");
                        } else {
                                $("#dgf_modal").html(result);
                                $("#dgf_modal").css('visibility', 'visible');
                                $("#dgf_modal").dialog({
                                        modal: true,
                                        closeOnEscape: false,
                                        resizable: false,
                                        draggable: false,
                                        title: "Deleting Group",
                                        width: 500,
                                        height: 500,
                                        buttons: {
                                                "Yes" : function(){
                                                        alert("Well, okay then.");
                                                        $("#dgf_modal").dialog("close");
                                                },
                                                "Cancel" : function(){
                                                        $("#dgf_modal").dialog("close");
                                                }
                                        },
                                        close: function(){
                                                $("#dgf_modal").html("");
                                                $("#dgf_modal").css('visibility', 'hidden');
                                                $(this).dialog("destroy");
                                        }
                                });
                                $("#dgf_modal").dialog("open");
                        }
                },
                error: function(){
                        setlongmessage("An error has occurred. Contact your system administrator.");
                        $("#dgf_status").html("<img src='images/error.png' alt='An error occured.'/>");
                        setTimeout(function(){$("#dgf_status").html("");}, 3000);
                }
        });
}

I’ve got similar code in another section of my application which works just fine. However, with this one I’m getting the following error:

Error: cannot call methods on dialog prior to initialization;
attempted to call method ‘open’

throw new Error( msg );

jquery.js (line 477)

EDIT: I get the same error message if I call dialog(“open”) or dialog(“close”) on the div. Same stack trace, the only error that changes is that it attempted to call method ‘close’ instead of ‘open’.

I’m using the latest versions of jQueryUI and jQuery, as I thought that perhaps updating them would resolve this issue. No dice. Perhaps I’m messing up somewhere in this function, but I do know for sure that the ajax call is returning the proper HTML that it should be returning.

Everything else checks out – I do have my div with the ID dgf_modal, and that works fine. Not exactly sure what’s messing up on me now though.

  • 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-06-14T00:59:08+00:00Added an answer on June 14, 2026 at 12:59 am

    Well, I’ve figured it out. It was my AJAX call after all, returning two divs with the id “dgf_modal”. Accidentally tossed that into my for loop when I’m automatically generating table cells as opposed to at the end when I actually close off the table.

    In short, I’m an idiot.

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

Sidebar

Related Questions

I'm writing a simple AJAX call that returns a full HTML page and then
I am writing jquery ajax code to call wcf service. In this case WCf
Help needed. Im writing a function that returns result of ajax call but i
I am writing a web application which retrieves a lot of data using AJAX
I'm writing a Javascript app that is getting an HTML document via AJAX, then
I'm doing one app which requires AJAX call on almost every user interaction possible,
I am writing some code to generate anchor elements via Ajax call to the
I'm writing a PHP application which uses AJAX to submit forms via POST when
I have created a http handler fro my Jquery ajax call. which is working
I'm currently writing an application which uses ajax on the front end and ASP.NET

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.