zoukankan      html  css  js  c++  java
  • 失去焦点 显示是否用户名存在

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="../jquery-1.11.2.min.js"></script>
    <title>无标题文档</title>
    </head>
    
    <body>
    <input type="text"  id="uid"/>
    <span id="ts"></span>
    
    </body>
    <script type="text/javascript">
    $("#uid").blur(function(){
        var uid=$("#uid").val();
        $.ajax({
              url:"uidchuli.php",
              data:{n:uid},
              type:"POST",
              dataType:"TEXT",
              success:function(data){
                  
                     if(data>0)
                     {
                         $("#ts").html("该用户已存在");
                         $("#ts").css("color","red")
                     }
                     else
                     {
                         $("#ts").html("该用户名可用");
                         $("#ts").css("color","green");
                         
                         }
                  
                  }
            
            })
        
        
        
        
        })
    </script>
    </html>
    <?php
    $uid=$_POST["n"];
    include("../DBDA.class.php");
    $db=new DBDA();
    $sql="select count(*) from info where Name = '{$uid}'";
    echo $db->StrQuery($sql);
  • 相关阅读:
    缓存(二)
    缓存
    SQL Server 导入大数据脚本
    C#执行OracleHelper
    MERGE 用法
    c# 高效读写文件
    C#网络编程
    C#常用IO流与读写文件
    注册asp.net 4.0 到iis
    javascript原生图片懒加载
  • 原文地址:https://www.cnblogs.com/benpaodegegen/p/6053263.html
Copyright © 2011-2022 走看看