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

  • SEARCH
  • Home
  • 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 6786631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:16:08+00:00 2026-05-26T17:16:08+00:00

I have a function like: uiModal.simpleModal(‘<p>This is some content</p>’); Which should call a modal

  • 0

I have a function like: uiModal.simpleModal('<p>This is some content</p>');

Which should call a modal with the passed data as the modal content. e.g. (note I haven’t added the modalHtml as it’s not relevant to this question).

simpleModal: function (data) {

    var responseHtml = data;

    // Append the modal HTML to the DOM
    var modalInstance = $('body').append(modalHtml);

    // Dynamically load in the passed data from the call
    $.ajax({
        timeout: 5000,
        success: function (responseHtml) {
            $(modalInstance).find('.uiModalContent').html($(responseHtml));
            $(modalInstance).find('.uiModalContent').removeClass('loading');

            isModalSuccess = true;
        },
        error: function () {
            $(modalInstance).find('.uiModalContent').html('<div class="message error"><h2>Unknown Error</h2> Please contact support</p></div>');
            $(modalInstance).find('.uiModalContent').removeClass('loading');
        }
    });

    $(modalInstance).find('.ModalClose').live('click', function (e) {
        e.preventDefault();
        $(this).parents('.uiModal').fadeOut(function () { $(this).parents('.uiModalWrapper').remove() });
    });
},

However it doesn’t load in the data! Can someone point me in the right direction

Thanks

  • 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-26T17:16:08+00:00Added an answer on May 26, 2026 at 5:16 pm

    It looks like you haven’t told your ajax method where to load the data from.

    You need to pass in a URL from which you will load your data:

    $.ajax({
            url: "http://www.example.com/jsonRequest",
            timeout: 5000,
            success: function (responseHtml) {}
    });
    

    UPDATE

    Given your comment below it seem that you might have a slight misunderstanding of what ajax is designed for.

    In your case you already have the data for the modal window and so you can use it without the need for an ajax call.

        $(modalInstance).find('.uiModalContent').html($(responseHtml));
        $(modalInstance).find('.uiModalContent').removeClass('loading');
    

    If you also need to check that the data exists in your respoonseHtml variable then you can do that with a simply if statement:

    if(responseHtml.length > 0)
    {
            $(modalInstance).find('.uiModalContent').html($(responseHtml));
            $(modalInstance).find('.uiModalContent').removeClass('loading');
    }
    else
    {
       $(modalInstance).find('.uiModalContent')
         .html('Error message here');
       $(modalInstance).find('.uiModalContent').removeClass('loading');
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function like this that does an ajax call to grab some
Suppose I have a function like this: def getNeighbors(vertex) which returns a list of
I have a function like this which checks whether the field is empty or
i have a function like this. i want reset the $output var first call.
I have a function like this: MyFunction(double matrix[4][4]) {/*do stuff*/} I am calling this
I have a function like this in actionscript3 private function uploadFile(event:MouseEvent):void { var uploader:URLRequest
If I have a function like this: function abc($a,$b,$c = 'foo',$d = 'bar') {
This is on the iPhone. So what if I have a function like -
I have a function defined like this: public static void ShowAbout(Point location, bool stripSystemAssemblies
Assume I have a function template like this: template<class T> inline void doStuff(T* arr)

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.