日期:2014-05-17 浏览次数:20432 次
<div> <table style="width: 90%;"> <tr> <th colspan="3"> <strong>基本信息</strong> </th> </tr> <tr> <td style="width: 30%;"> <strong>电子邮箱:</strong> </td> <td style="width: 30%;"> <input id="email" name="email" value="" onblur="CheckEmail()" /> </td> <td id="errorEmailMsg" style="width: 30%;"> </td> </tr> <tr> <td style="width: 30%;"> <strong>姓名:</strong> </td> <td style="width: 30%;"> <input id="name" name="name" value="" /> </td> <td style="width: 30%;"> </td> </tr> </table> </div> <script language="javascript" type="text/javascript"> var CheckEmail = function () { var currentEmail = $("#email").val(); $.ajax({ url: "/Test/CheckEmail", dataType: "json", type: "post", data: "email=" + currentEmail, success: function (result) { if (result.isEmailExist == "1") { $("#errorEmailMsg").html("<span style='color:red'>当前Email已经存在,请换一个。</span>"); } else { $("#errorEmailMsg").html("<span style='color:green'>Email不存在测试成功</span>"); } } }) } </script>
------解决方案--------------------
正解~