팝업창에서 db 저장시 시간이 걸립니다
본문
위 사진과 같이 아래의 코드를 이용하여 모달팝업시켜서 DB에 3개의 칼럼을 저장하게 됩니다
근데 등록버튼을 누르고 등록하기까지 5초 정도 걸리는거 같습니다
왜 이리 시간이 걸리는 걸까요??
등록버튼 누르면 바로 저장이 되었으면 좋겠습니다 ㅠㅠ
<meta charset="euc-kr">
<!-- TemplateBeginEditable name="doctitle" -->
<title>무제 문서</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
<style type="text/css">
.form-box{padding:15px 20px 15px 20px;background:#004166;color:#004166;display:table;width:480px;height: 435px}
.form-box .new-l-con{float:left;width:100%;margin-right:2%;margin-top:17px;}
.form-box .new-l-con .l-s-txt{text-align:right;float:left;font-size:15px;}
.form-box .new-l-con h2{float:left;margin-left:2%;font-size:30px;color:#fff;font-weight:300;}
.form-box .new-l-con .r-number{float:left;margin-left:5%;font-size:36px;line-height:100%;font-weight:bold;color:#f9cc3d;}
.form-box .new-l-con .r-number:before{content:"";background:url("theme/nero28/img/icon4.png") no-repeat;width:32px;height:31px;background-size:100%; display: inline-block;vertical-align:-1px;margin-right:5px;}
.form-box .new-r-con{float:left;width:100%;}
.form-box .new-r-con .new-t-con{display:table;width:100%;}
.form-box .new-r-con .l-in{float:left;width:calc(100%);}
.form-box .new-r-con .l-in input{float:left;width:100%;padding-left: 30px; border:0;border-bottom:1px solid #000;height:55px;line-height:55px;background:none;color:#000000;font-size:18px;}
.form-box .new-r-con .l-in input:last-child{margin-right:0;}
.form-box .new-r-con .l-in input::placeholder{color:#646464; font-size:18px;}
.form-box .new-r-con .r-btn{float:right;width:88%;text-align:center;font-size:30px;background:#f9cc3d;color:#333;border:0;height:60px;line-height:40px;}
.form-box .new-r-con .new-b-con{margin-top:5px;}
.form-box .new-r-con .new-b-con a{padding:5px 10px;background:#777;color:#fff;font-size:11px;margin-top:2px;margin-left:20px;display:inline-block;}
.form-box .new-r-con .l-in ::-webkit-input-placeholder { /* Chrome/Opera/Safari */
color: #fff;
}
.form-box .new-r-con .l-in ::-moz-placeholder { /* Firefox 19+ */
color: #fff;
}
.form-box .new-r-con .l-in :-ms-input-placeholder { /* IE 10+ */
color: #fff;
}
.form-box .new-r-con .l-in :-moz-placeholder { /* Firefox 18- */
color: #fff;
}
</style>
<div class="form-box" >
<form name="fwrite" method="post" onSubmit="return submitChk(this)">
<input type=hidden name=sca value="<?=$sca?>">
<div class="boxy-warp">
<div class="form-con">
<div class="new-r-con">
<div class="new-b-con">
<table width="100%">
<tr>
<td colspan="2" style="vertical-align:middle"><font color="#FFFFFF" size="7"><b>빠른상담신청</b></font></td>
</tr>
<tr>
<td height="60" colspan="2" style="vertical-align:middle"><font color="#FFFFFF" size="4"><b>아래 이름과 전화번호를 입력하여 신청하면<br>
확인 후 순차적으로 연락드립니다.</b></font></td>
</tr>
<tr >
<td >
<input style="width:25px;height:25px;" type="checkbox" name="wr_9" required value="1"<?php echo ($write['wr_9'] == "1") ? " checked" : "";?>>
</td >
<td > <font color="#FFFFFF" size="4" style="vertical-align: middle"><b>개인정보수집이용에 동의합니다.</b></font> </td>
</tr>
</table>
</div>
<table width="100%">
<tr>
<td height="5" style="vertical-align:middle;border-bottom:2px solid #ffffff;">
</td></tr>
<tr>
<td height="20" >
</td></tr></table>
<div class="new-t-con">
<div class="l-in">
<table width="100%" >
<tr>
<td align="center" height="68" style="vertical-align:middle"><font color="#FFFFFF" size="4"><b>이름</b></font>
</td>
<td align="right" height="68" style="vertical-align:middle">
<input type="name" style="border: 1px; background:#FFFFFF ;" name='wr_name' class="form-control" placeholder="성함을 입력해 주세요 *" id="anb-contact-name" required="name" aria-invalid="false" maxlength="20">
</td>
</tr>
<tr>
<td align="center" height="68" style="vertical-align:middle">
<font color="#FFFFFF" size="4"><b>연락처</b></font>
</td>
<td align="right" height="68" style="vertical-align:middle">
<input type="tel" style="border: 1px; background:#FFFFFF ;" name='wr_2' class="form-control" placeholder="휴대폰 번호 입력하세요 *" id="anb-contact-phone" required="phone" oninput="maxLengthCheck(this)" onkeyup="onlynumberic(event)" aria-invalid="false" maxlength="11">
</td>
</tr>
<tr>
<td height="70" colspan="2" align="center" style="vertical-align:middle">
<div class="text-center anb-contact">
<button type="submit" class="r-btn white anb-submit"><b>무료상담신청</b></button>
<div class="iclear"><input type="hidden" name="secret" value="secret"></div>
</div>
</td>
</tr>
</table>
</div></div>
</div></div></div>
</form> </div>
<script language="javascript">
$(document).ready(function(e) {
$('.anb-submit').click(function(){
var sName = $('#anb-contact-name').val();
var sPhone = $('#anb-contact-phone').val();
if ($.trim(sName).length == 0) {
alert('성함을 입력해 주세요');
return;
}
if ($.trim(sPhone).length == 0) {
alert('휴대폰 번호 입력하세요');
return;
}
});
});
function ajax_contact2 (){
var sName = $('#anb-contact-name').val();
var sPhone = $('#anb-contact-phone').val();
if(data.result == 'success' ){
//성공시 폼삭제
$('#anb-contact-name').val('');
$('#anb-contact-phone').val('');
alert(data.msg);
}
}
//maxlength 체크
function maxLengthCheck(object){
if (object.value.length > object.maxLength){
object.value = object.value.slice(0, object.maxLength);
}
}
//숫자만남기고제거
function onlynumberic(event) {
event.target.value = event.target.value.replace(/[^0-9]/g, "");
}
function submitChk(f)
{
f.action = "../form_ok.php";
return true;
}
</script>
답변 2
자바스크립트가 아니라 mysql 문제 같아 보입니다.
구글에서 "mysql slow query 분석" 이라고 검색해서 자료를 찾아보세요.
저장을 실행하는 코드를 보아야지 폼만보고서 문제를 파악할 수있나요
답변을 작성하시기 전에 로그인 해주세요.