$(document).ready(function () { $('#iframe').on('hide.bs.modal', function () { $("#iframe").html(''); }); $(".load_page").click(function (event) { event.preventDefault(); $("#iframe").modal("hide"); $("#iframe").html(''); $.get($(this).attr('href'), function (html) { setTimeout(function () { $("#iframe").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").html(''); var list = '/app/main/index'; $.get(list, function (html) { setTimeout(function () { $("#iframe").append(html); $("#iframe").modal("show"); }, 500); }); } }).fail(function (jqXHR, textStatus) { alert("Request failed: " + textStatus); }); }); $(".load_orderpage").click(function (event) { event.preventDefault(); $.ajax({ url: $(this).attr('href') }).done(function (data) { if (data == "true") { $("#iframe").modal("hide"); $("#iframe").html(''); var list = '/app/main/index'; $.get(list, function (html) { setTimeout(function () { $("#iframe").append(html); $("#iframe").modal("show"); }, 500); }); } else if(data == "nonexistent"){ alert('상위/하위 데이터가 없습니다.'); $("#iframe").modal("hide"); $("#iframe").html(''); var list = '/app/main/index'; $.get(list, function (html) { setTimeout(function () { $("#iframe").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").html(''); var list = '/app/main/index'; $.get(list, function (html) { setTimeout(function () { $("#iframe").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").html(''); var list = '/app/main/index'; console.log('asdadsad'); console.log(list); $.get(list, function (html) { setTimeout(function () { $("#iframe").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").html(''); var list = '/app/main/index'; $.get(list, function (html) { setTimeout(function () { $("#iframe").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.trim() == "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").html(''); setTimeout(function () { $("#iframe").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'); });