코드중복 확인을 ajax 방식으로 변경 #213

This commit is contained in:
gnuboard
2013-06-07 16:17:19 +09:00
parent b6aa16deac
commit 2e7a5b468c
4 changed files with 75 additions and 34 deletions

View File

@ -194,7 +194,7 @@ $pg_anchor ='<ul class="anchor">
<!-- <input type=text class=required name=it_id value="<?php echo 10000000000-time()?>" size=12 maxlength=10 required> <a href='javascript:;' onclick="codedupcheck(document.all.it_id.value)"><img src='./img/btn_code.gif' border=0 align=absmiddle></a> -->
<?php echo help("상품의 코드는 10자리 숫자로 자동생성합니다. <b>직접 상품코드를 입력할 수도 있습니다.</b>\n상품코드는 영문자, 숫자, - 만 입력 가능합니다."); ?>
<input type="text" name="it_id" value="<?php echo time(); ?>" id="it_id" required class="frm_input required" size="20" maxlength="20">
<?php if ($default['de_code_dup_use']) { ?><button type="button" class="btn_frmline" onclick="codedupcheck(document.all.it_id.value)">중복검사</a><?php } ?>
<!-- <?php if ($default['de_code_dup_use']) { ?><button type="button" class="btn_frmline" onclick="codedupcheck(document.all.it_id.value)">중복검사</a><?php } ?> -->
<?php } else { ?>
<input type="hidden" name="it_id" value="<?php echo $it['it_id']; ?>">
<span class="frm_ca_id"><?php echo $it['it_id']; ?></span>
@ -1334,8 +1334,23 @@ function fitemformcheck(f)
}
if (f.w.value == "") {
if (f.codedup.value == '1') {
alert("코드 중복검사를 하셔야 합니다.");
var error = "";
$.ajax({
url: "./ajax.it_id.php",
type: "POST",
data: {
"it_id": f.it_id.value
},
dataType: "json",
async: false,
cache: false,
success: function(data, textStatus) {
error = data.error;
}
});
if (error) {
alert(error);
return false;
}
}