经测试,前面的一篇文章有错误,现在修订如下:
有错误的文章:录入时检测数据是否存在的验证
一、前端代码
function checkbqid() { var bqid = $("#txtBqid").val().replace(/s/g, ""); //删除所有空格 if (bqid.length<5) { alert("请输入5位数班期ID"); return; } $.ajax({ type: 'get', url: 'bqidcheck.ashx', contentType: "application/json;charset=utf-8", dataType: "text", data: { bqid: bqid }, success: function (data) { if (data=="True") { $("#remind").html(""); $("#txtBqid").focus(); } else { $("#remind").html(""); } },