jquery Ajax application Instance <!doctype HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title>jquery Ajax Application Example </title>
<script language= "Web Effects" >
$ (document). Ready (function () {
var a={};$ (". Followpreview"). Mouseo Tutorial ver (function () {
var h=$ (this); var b=h.attr ("IDs"), D=h.offset (). Left,j=h.offset (). Top+h.height (), g= ""; var e=$ ("Body"). width ();
if (e-d<210) {d=d-186;g= "followerpreviewboxarrright"}else{g= "Followerpreviewboxarrleft";}
A[b]=window.settimeout (function () {
var l= "box" +b;var k=b.replace ("Fu", "");
if (document.getElementById (l) ==null) {
$ ("Body"). Append (' <div class= "Followerpreviewbox" id= "' +l+ '" ></div> ');
$ ("#" +l). CSS tutorial ({left:d,top:j}). Fadein (500);
$.ajax ({type: "Get", url:webaddr+ "/www.111cn.net/ajax.php" Tutorial? act=getuserinfo&uid= "+k+" &class= "+g+" & rank= "+getrandomnum (1,999999), Success:function (msg) {$ (" # "+l). HTML (msg). CSS (" BackgroundImage "," none ");}});
}else{$ ("#" +l). Fadein}},500); function C () {var l=$ (this). attr ("id"); window.cleartimeout (A[l]); var k= "box" +l;$ ("#" +k). Fadeout (500)}}
). Mouseout (function () {var c=$ (this). attr ("id"); window.cleartimeout (a[c)); var b= "box" +c;$ ("#" +b). Hide ()})};
</script>
<body>
ajax.php file
<?php
$api = 1;
Include ('.. /common.inc.php ');
//Send DMS
if ($action = = ' send ') {
$content = Trim ($_post["content");
$funame = $_ post["Funame"];
$user =user_info ("User_name= ' $funame");
if (! $user [' user_id ']) {
echo ' The user you sent does not exist ';
exit;
}
if (!empty ($content)) {
$content =getsubstrutf8 ($content, 0,140,false);
$content =replace ($content);
$content =daddslashes ($content);
$db->query ("update et_users set priread = priread+1 where user_id= ' $ USER[USER_ID] "");
$db->query ("INSERT into Et_messages senduid,sendname, Sendnickname,sendhead,sendtouid,sendtoname,sendtonickname,messagebody,sendtime) VALUES (' $my [user_id] ', ' $my [user _name] ', ' $my [nickname] ', ' $my [User_head] ', ' $user [user_id] ', ' $user [user_name] ', ' $user [nickname] ', ' $content ', ' $ Addtime ') ");
Echo ' success ';
exit;
} else {
echo ' You did not fill in the sent content, return to fill in ';
& nbsp; exit;
}
}
if ($act = = ' GetUserInfo ') {
$uid =$_get[' uid ';
$class =$_get[' class '] ;
$userquery = $db->query ("Select Nickname,user_head,lastcontent,lastconttime from Et_users where user_id= ' $uid ');
$user = $db->fetch_array ($userquery);
$head = $user [' User_head ']? $webaddr/attachments/head/". $user [' User_head ']:" $webaddr/images/noavatar.jpg ";
$content =simplecontent ($user [lastcontent]);
$time = $user [Lastconttime]?timeop ($user [lastconttime]): "";
Echo ' <div class= '. $class. ' " ></div><table width= "border=" 0 "cellpadding=" 0 "cellspacing=" 0 "><tr><td width=" 53 " Rowspan= "2" align= "left" valign= "top" ></td><td><strong > '. $user [nickname]. ' :</strong> '. EMOTIONRP ($content). ' </TD></TR><TR><TD class= "Followtime" > '. $time. " </td></tr></table> ";
Exit
}
if ($act = = ' Getreplycontent ') {
$contid =$_get[' Contid '];
$contdata =getreply ($contid);
if ($contdata) {
$contents =ubb ($contdata [' content_body ']);
Echo ' <div class= "Status_reply_list" >
<div class= "Top" ></div>
<div class= "cont" >
<H1 class= "line" > Below is the original: <a href= "'. $webaddr. ' /op/view/'. $contid. ' " > Original reply (' $contdata [' replytimes ']. ') </a><div class= "Replyajaxbox" ><a href= "'. $webaddr. ' /'. $contdata [' user_name ']. ' " > '. $contdata [' User_nickname ']. ' </a>: '. $contents. ' </div>
</div>
<div class= "Bottom" ></div>
</div> ';
}
}
?>
</body>