title: Calling a JavaScript function from a Rails Controller
body: <p>The project I'm working on renders several pages (such as login pages and signup forms) as modals, which is accomplished by giving those links the class .modal so the following piece of JavaScript would trigger:</p>
  
  <pre><code>$('.modal').click(function(){
      var url = this.href;
      var dialog = $('&lt;div id="modal" style="display:none"&gt;&lt;/div&gt;').prepend('#barhappy_container');
      dialog.load(url, function(){
          dialog.dialog({
              modal: true,
              draggable: false,
              position: 'center',
              dialogClass: 'no-title',
              width: 'auto',
  /*          height: 'auto', */
              resizable: false,
              open: function(){
                  $.getScript('/assets/modal/in-modal-open.js');
              },
              close: function(event, ui){
                  dialog.remove();
              }
          });
      });     
      return false;
  });
  </code></pre>
  
  <p>However, I now need a page rendered by a Controller to display the same way, but there's no link to click that can be given the class .modal.</p>
  
  <p>So, is there a way to call this JavaScript function from my Rails controller and pass it the proper parameters?</p>