아래의 코드를 얻기 위해 몇 가지 stackoverflow 질문을 결합했습니다. 링크는 ajax를 통해 모달 벌금으로 편집 양식을로드하지만 양식이 제출되면 전체 페이지가 제출되고 다시로드됩니다. 내가 다시 모달에만 모달 싶습니다. 후 숨겨진 iframe이에 jquery 대화 상자로드 양식을 통해 아약스, 양식 대화 상자를 다시 제출하십시오.
을 양식을 제출
- 는 AJAX
- 를 통해 양식을 제출, 제출 모델의 내용을 갱신 처리 :
<script charset="utf-8" type="text/javascript"> $(document).ready(function() { jQuery(".ajax").click(showDialog); //variable to reference window $myWindow = jQuery('##myDiv'); //instantiate the dialog $myWindow.dialog({ height: 350, width: 400, modal: true, position: 'center', autoOpen:false, title:'Edit Policy', overlay: { opacity: 0.5, background: 'black'}, open: function(type,data) { $(this).parent().appendTo("form"); } }); } ); //function to show dialog var showDialog = function() { $('##myDiv').load( this.href, {}, function (responseText, textStatus, XMLHttpRequest) { //if the contents have been hidden with css, you need this $myWindow.show(); //open the dialog $myWindow.dialog("open"); } ); //prevent the browser to follow the link return false; } //function to close dialog, probably called by a button in the dialog var closeDialog = function() { $myWindow.dialog("close"); } </script>