Welcome Guest, Not a member yet? Register   Sign In
template structure for tabbed modal

I'm starting to tie my brain in knots with this one so thought I would ask here.

I need a modal dialog with tabs for 'comments', 'favourites' and 'sharing'. All will have dynamic, AJAX updatable content within them.

I'm using jquery-modal, have MVC set up separately for comments, favourites & sharing, and can get them to AJAX load in separate modals just fine.

What I can't work out is how to trigger the modal to open a specific tab when clicking on 'comments', 'share' or 'favourites' on the page and the load the content from 3 different controllers with their associated views.

Actually thinking about this now, maybe I need a modal controller instead of the separate controllers which loads the three models and manages everything from there? Does that make sense?

(This post was last modified: 05-12-2015, 04:17 AM by sintakonte.)

don't know if i understand you correctly but try to create a javascript object something like:
(function (app, $, undefined) {

}(window.app = window.app || {}, jQuery));

app.autoLoad = function()    {


app.modal = {
    autoLoad : function ()  {

    attachEventsToTabs : function()
        $("#my-modal").on($.modal.AJAX_COMPLETE, function(){
            //insert here your code for your tab clicks
            $("#tab-comments").on("click",function()    {
                $.get("/modal/comments/", function(data) {


with this version you are able to attach events to your tabs
and on the serverside you need one controller which handles your tab views

a modal controller sounds fine

if i read right you are looking for something like this:

"I reject your reality and substitute my own" - Adam Savage, M5 Inc.

Theme © iAndrew 2016 - Forum software by © MyBB