<! -- This is a simple example of ajax php tutorial User Login instance code
<! Doctype html public "-// w3c // dtd xhtml 1.0 strict // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml" xml: lang = "en" lang = "en">
<Head>
<Title> ajax php user login instance jquey_login by http://www.bKjia. c0m </title>
<Meta http-equiv = "content-type" content = "text/html; charset = gbk"/>
<Script type = "text/Webpage effects" src = "js/jquery-1.3.1.min.js"> </script>
<Script type = "text/javascript">
/* <! [Cdata [*/
$ (Document). ready (function (){
Var value = $ ('# button input'). val ();
Var name = $ ('# button input'). attr ('name ');
$ ('# Button input'). remove ();
Certificate ('{button'{.html ('<a href = "#" class = "css tutorial submitbutton" rel =' + name + '>' + value + '</a> ');
$ ('# Button A'). live ('click', function (){
Var link = $ (this );
$. Ajax ({
Url: 'Load. php ',
Data :'',
Type: 'get ',
Cache: 'false ',
Beforesend: function (){
Link. addclass ('loading ');
},
Success: function (){
Link. removeclass ('loading ');
Alert ('submitted ');
}
});
});
});
/*]> */
</Script>
<Style type = "text/css">
Body {
Font-family: arial;
Font-size: 12px;
Margin: 10px;
Text-align: center;
}
Form {
Margin: 0 auto;
Text-align: left;
Width: 270px;
Border: 1px solid # ccc;
Padding: 15px;
Background: # fff;
Border-radius: 10px;
-Moz-border-radius: 10px;
-Webkit-border-radius: 10px;
Box-shadow: 0 0 4px # ccc;
-Webkit-box-shadow: 0 0 4px # ccc;
-Moz-box-shadow: 0 0 4px # ccc;
}
Fieldset {
Overflow: hidden;
Border: 0;
Height: 30px;
Margin: 3px 0;
}
Fieldset label {
Display: block;
Width: 50px;
Float: left;
Font-weight: 700;
Color: #666;
Line-height: 2.2em;
}
Fieldset input {
Float: left;
Border: 1px solid # ccc;
Height: 20px;
Padding: 3px;
Width: pixel PX;
Font-size: 12px;
}
# Button {
Margin-top: 10px;
Padding-right: 20px;
Text-align: right;
}
# Button input {
Margin: 0 auto;
}
A.css submitbutton {
Font-size: 12px;
Background: # fff no-repeat 4px 5px;
Display: inline-block;
Padding: 5px 20px 6px;
Color: #333;
Border: 1px solid # ccc;
Text-decoration: none;
Font-weight: bold;
Line-height: 1.2em;
Border-radius: 15px;
-Moz-border-radius: 15px;
-Webkit-border-radius: 15px;
-Moz-box-shadow: 0 1px 3px #999;
-Webkit-box-shadow: 0 1px 3px #999;
Position: relative;
Cursor: pointer;
Outline: none;
}
A.css submitbutton: visited {}
A.css submitbutton: hover {
Border: 1px solid #333;
}
. Loading {
Background-image: url('load.gif ')! Important;
Color: # ccc! Important;
-Moz-box-shadow: 0 0 0 # fff! Important;
-Webkit-box-shadow: 0 0 0 # fff! Important;
}
. Effect {
Border-radius: 5px;
-Moz-border-radius: 5px;
-Webkit-border-radius: 5px;
}
</Style>
</Head>
<Body>
<Form method = "post" action = "" name = "subscribeform">
<Fieldset>
<Label> name: </label> <input type = "text" class = "effect" name = "name">
</Fieldset>
<Fieldset>
<Label> email: </label> <input type = "text" class = "effect" name = "email">
</Fieldset>
<Div id = "button">
<Input type = "submit" value = "subscribe" name = "subscribeform"/>
</Div>
</Form>
</Body>
</Html>
Effect preview address
Http://g.111cn.cn/javascript/js/20100830/jquery%20Create an ajax logon button with status prompt
Download instance
Http://down.bKjia. c0m/down/code/jquery/2010/0830/20529.html