ajax没写过,高手们帮忙
submit.asp
-----------------------
<form action="submit_check.asp" method='post' id=form1 name=form1 >
<table width="100%" border="0" bgcolor="#ffd8b0" cellspacing="2" cellpadding="0" height="34">
<tr>
<td width="153" bgcolor="#ffffe6" height="31"> <font color="#FF040B">SAP CODE </font> </td>
<td width="187" bgcolor="#fff9ec" height="31"> <input name="sap_code" class="inputbpcsform" id="sap_code" maxlength="30"> </td>
<td width="147" bgcolor="#ffffe6" height="31"> </td>
<td width="264" bgcolor="#fff9ec" height="31"> </td>
</tr>
</table>
<input type="submit" name="Agree" value="Submit" style="width:60px;border:1px solid rgb(150,150,150);font-size:12px" onclick="return check_sap()">
</form>
<script language="javascript">
function check_sap(){
var sapCode = document.getElementById("sap_code").value;
var re = /^\d{8}$/;
if(!re.test(sapCode)){
alert("sap_code必须为8位数字!");
return false;
}else{
//这里进行ajax调用,判断表tbl_sap中有没有sap_code
//如果有alert("已有该号码");return false;
}
}
</script>
-----------------------
红色部分的ajax不知道这样写,求代码