$(document).ready(function(){ $('#iframe').on('hide.bs.modal', function() { $(this).remove(); }); $(".load_page").click(function(event){ event.preventDefault(); $("#iframe").modal("hide"); $("#iframe").remove(); $.get($(this).attr('href'), function(html) { setTimeout(function(){ $("#page-container").append(html); $("#iframe").modal("show"); }, 500); }); }); $(".load_action").click(function(event){ event.preventDefault(); $.ajax({ url: $(this).attr('href') }).done(function( data ) { if(data=="true") { $("#iframe").modal("hide"); $("#iframe").remove(); var list = '/app/common/index?tag=%EC%A7%80%EC%9B%90%EC%82%AC%EC%97%85'; $.get(list, function(html) { setTimeout(function(){ $("#page-container").append(html); $("#iframe").modal("show"); }, 500); }); } }).fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); }); $('.load_delete').click(function(event){ event.preventDefault(); if(confirm('삭제 하시겠습니까?')) { $.ajax({ url: $(this).attr('href') }).done(function( data ) { if(data=="true") { $("#iframe").modal("hide"); $("#iframe").remove(); var list = '/app/common/index?tag=%EC%A7%80%EC%9B%90%EC%82%AC%EC%97%85'; $.get(list, function(html) { setTimeout(function(){ $("#page-container").append(html); $("#iframe").modal("show"); }, 500); }); } }).fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); } }); $(".popup_delete").click(function(event){ event.preventDefault(); if(confirm('삭제 하시겠습니까?')) { document.location.replace($(this).attr('href')); } return false; }); /*알반 시작*/ $('.write_form').ajaxForm({ beforeSubmit: function(data, form, options) { if(!doPopupWrite($(this))) { return false; } }, complete: function(xhr) { console.log(xhr); if(xhr.responseText=="true") { $("#iframe").modal("hide"); $("#iframe").remove(); var list = '/app/common/index?tag=%EC%A7%80%EC%9B%90%EC%82%AC%EC%97%85'; $.get(list, function(html) { setTimeout(function(){ $("#page-container").append(html); $("#iframe").modal("show"); }, 500); }); } } }); $('.edit_form').ajaxForm({ beforeSubmit: function(data, form, options) { if(!doPopupEdit($(this))) { return false; } }, complete: function(xhr) { console.log(xhr); if(xhr.responseText=="true") { $("#iframe").modal("hide"); $("#iframe").remove(); var list = '/app/common/index?tag=%EC%A7%80%EC%9B%90%EC%82%AC%EC%97%85'; $.get(list, function(html) { setTimeout(function(){ $("#page-container").append(html); $("#iframe").modal("show"); }, 500); }); } } }); $('.form').ajaxForm({ beforeSubmit: function(data, form, options) { if(!doPopupSubmit($(this))) { return false; } }, complete: function(xhr) { console.log(xhr); if(xhr.responseText=="true") { document.location.reload(); } } }); $('.search_form').submit(function(event){ event.preventDefault(); $.ajax({ type: "GET", data: $(this).serialize(), url: $(this).attr('action') }).done(function( html ) { $("#iframe").modal("hide"); $("#iframe").remove(); setTimeout(function(){ $("#page-container").append(html); $("#iframe").modal("show"); }, 500); }).fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); }); /*알반 끝*/ //툴팁 $('[data-toggle="tooltip"]').tooltip({'placement':'top'}); $('[data-toggle="tooltip"]').tooltip('toggle'); $('[data-toggle="tooltip"]').tooltip('hide'); });