Registration Real-time verification (Ajax,jquery)

Source: Internet
Author: User

When we register a user, will prompt that the user's information is available, this is the AJAX application, has seen this realization long ago, today looked again, to record down O (∩_∩) o ha.

I also have this introduction on my original blog ... http://hi.baidu.com/%BD%A3%BE%B2%B7%E3/blog/item/a8ddd2eb8a379d00fdfa3c06.html

To introduce the $.get in Ajax, because $.post usage and $.get are similar to no longer introduced (from the http://www.w3school.com.cn):

This is a simple GET request function to replace the complex $.ajax. Callback functions can be invoked when the request succeeds. If you need to perform a function when an error occurs, use $.ajax.

$ (selector). Get (Url,data,success (RESPONSE,STATUS,XHR), DataType)
Parameters Description
Url Necessary. Specify which URL to send the request to.
Data Optional. Specify the data to be sent to the server along with the request.
Success (RESPONSE,STATUS,XHR)

Optional. A function that is required to run when a request succeeds.

Extra parameters: Response-Contains the result data from the request status-contains the requested State XHR-contains the XMLHttpRequest object

DataType

Optional. Specify the data type of the expected server response.

By default, JQuery will intelligently judge.

Possible types: "xml" "HTML" "text" "Script" "JSON" "JSONP"

Request test.php Web page, ignore return value:

$.get ("test.php");
more examples Example 1

Request test.php Web page, transfer 2 parameters, ignore return value:

$.get ("test.php", {name: "John", Time: "2pm"});
Example 2

Displays the test.php return value (HTML or XML, depending on the return value):

$.get ("test.php", function (data) {
  alert ("Data Loaded:" + data);
});
Example 3

Displays the test.cgi return value (HTML or XML, depending on the return value), and adds a set of request parameters:

$.get ("test.cgi", {name: "John", Time: "2pm"},
  function (data) {
    alert ("Data Loaded:" + data);
  });

Post My Code below:
<?php
$link =mysql_connect ("localhost", "root", "");
mysql_select_db ("test");
mysql_query ("Set names UTF8");/
$sql = "SELECT * from user where user= '". $_get[' username ']. "'; /
    $result =mysql_query ($sql) or Die (Mysql_error ());
$num =mysql_affected_rows ();
if ($num ==0)
$msg =1;
else 
    $msg =0;
echo $msg;/return value
mysql_close ($link);
? >


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.