Home > Backend Development > PHP Tutorial > php+jquery+ajax无刷新验证用户名,该怎么处理

php+jquery+ajax无刷新验证用户名,该怎么处理

WBOY
Release: 2016-06-13 13:31:56
Original
777 people have browsed it

php+jquery+ajax无刷新验证用户名
php+jquery+ajax无刷新验证用户名是否已存在,要一个尽量短的例子。

------解决方案--------------------
今天不忙,玩玩

HTML code



<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(function(){ 
    $("#getjson").bind("click",function(){
        $.ajax({
              type: "POST",
               url: "/index.php",
               data: "name="+$("#username").val(),
               success: function(msg){ 
                    alert(msg);
               }

        });
    });
})
</script>


<input type="text" id="username"><button id="getjson">获取</button>

 <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template