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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:34:26+00:00 2026-05-27T15:34:26+00:00

I want to show a twitter bootstrap modal as a response to a JS

  • 0

I want to show a twitter bootstrap modal as a response to a JS request. My show.js.erb function looks something like this:

$(document).ready(function() {

    $('#dialog').modal('show')

});

Here “dialog” is the modal’s id. The modal code itself looks something like this:

<div id="dialog" class="modal hide fade">
    <div class="modal-header">
          <a href="#" class="close">&times;</a>
          <h3> Showing Modal </h3>
    </div>
    <div class="modal-body">
        I need to show up!
    </div>
    <div class="modal-footer">
        <a href="#" class="btn primary">Done</a>
    </div>
</div>

One thing I am sure of is that the javascript is being called. I can have it alter items on the page. Another thing is that modal is working fine. It shows up just fine when I use an HTML button to trigger the request like this:

<button data-controls-modal="dialog" data-backdrop="true" data-keyboard="true" class="btn danger"> Show </button>

Any idea why the modal doesn’t show up on JS request?

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-27T15:34:26+00:00Added an answer on May 27, 2026 at 3:34 pm

    I had a similar problem, which I solved with a slight twist

    My modal div is rendered on the calling page (from a partial) and not by the response of the JS request:

    <div class="modal hide fade" id="modal-window">
      <div class="modal-header">
        <a href="#" class="close">×</a>
        <h3>Loading...</h3>
      </div>
      <div class="modal-body center">
          <%= image_tag "loading.gif" %>
      </div>
      <div class="modal-footer">&nbsp;</div>
    </div>
    

    I use this link to rely on rails and Twitter unobtrusive JS:

    <%= link_to negotiation.name, negotiation_path(negotiation), {:remote => true, 'data-controls-modal' =>  "modal-window", 'data-backdrop' => true, 'data-keyboard' => true} %>
    

    and my show.js.erb looks like this (shortened)

    $('.modal-body').html('<%= escape_javascript(render :partial => 'negotiationdetail', :object => @negotiation) %>');
    $('.modal-header').remove(); // don't need a header here
    

    This works fine and has the benefit of showing a “loading” animation to the user while the modal is being populated.

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

Sidebar

Related Questions

I have a modal created using Twitter Bootstrap. I want to open using javascript.
I want show the live-feed of Facebook and Twitter in my android-applications. Just like
I want to show a chromeless modal window with a close button in the
I am using this jquery javascript function to show status message, function topBar(message) {
I'm using twitter-bootstrap and am using the Modal JS plugin. I have a modal
I am using bootstrap-popover to show a message beside an element. If I want
I'm writing a Twitter app for Mac OS X. I want to show emoji
I will use twitter and show it on my page like a news-flash. I
I'm experimenting with Twitter Bootstrap 2.0 and want to use the popovers . I've
I want show annotation view (above one of my pin) after load map. For

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.