문제

I use this Bootsrap modal plugin and call some page in it. When a page needs postback or redirection, it does not happen in modal, it changes the page. So I want it to show pages in iframe which is in boostrap modal.

this is my modal func. code; how should I modify it for show contents in iframe?

$.fn.modal.defaults.spinner = $.fn.modalmanager.defaults.spinner =
      '<div class="loading-spinner" style="width: 200px; margin-left: -100px;">' +
        '<div class="progress progress-striped active">' +
          '<div class="progress-bar" style="width: 100%;"></div>' +
        '</div>' +
      '</div>';

    $.fn.modalmanager.defaults.resize = true;

    var $modal = $('#ajax-modal');

    $('.modal-edit').on('click', function () {
        // create the backdrop and wait for next modal to be triggered
        $('body').modalmanager('loading');

        var edit = $(this).attr("data-id");
        setTimeout(function () {
        $modal.load('User.aspx?edit=' + edit + '', '', function () {
            $modal.modal();
        });
        }, 100);
    });

this is my modal modal div:

  <div id="ajax-modal" class="modal fade" tabindex="-1" data-width="760" data-replace="true">
  </div>
도움이 되었습니까?

해결책

Try this;

    $('.modal-edit').on('click', function () {
            // create the backdrop and wait for next modal to be triggered
            $('body').modalmanager('loading');
            var edit = $(this).attr("data-id");
            setTimeout(function () {
                $modal.on('show', function () {
                    $('iframe').attr("src", 'Customer_User.aspx?edit=' + edit + '');
                });
                $modal.modal()
                //$modal.load('Customer_User.aspx?edit=' + edit + '', '', function () {
                //    $modal.modal();
                //});
            }, 100);
        });


<div id="ajax-modal" class="modal fade" tabindex="-1" data-width="760" >
                        <iframe ></iframe>
                    </div>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top