This article mainly introduces the implementation of similar Facebook without refreshing Ajax updates that need friends to refer to under
Code as follows: <script type= "Text/javascript" > $ (document). Ready (function () { $ ('. Edit_ Link '). Click (function () { $ ('. Text_wrapper '). Hide (); var data=$ ('. Text_wrapper '). HTML (); $ ( '. Edit '). Show (); $ ('. EditBox '), HTML (data); $ ('. EditBox '). focus (); }); $ (". EditBox"). MouseUp (function () { return false }); $ (". EditBox"). Change (function () { $ (' . Edit '). Hide (); var boxval = $ (". EditBox"). Val (); var datastring = ' data= ' + boxval; $.ajax ({ type : "POST", URL: "update_profile_ajax.php", data:datastring, cache:false, success:function ( HTML) { $ ('. Text_wrapper '). HTML (boxval); $ ('. Text_wrapper '). Show (); } }); }); $ (document). MouseUp (function () { $ ('. Edit '). Hide (); $ ('. Text_wrapper '). Show (); }); }); </script> <sTyle type= "Text/css" > body { font-family:arial, Helvetica, sans-serif; font-size :12px; } .mainbox { width:250px; margin:50px; } .text_wrapper { Border:solid 1px #0099CC; padding:5px; width:187px; } .edit_link {& nbsp float:right } .editbox { overflow:hidden; height:61px;border:solid 1px #0099CC; width:190px; fo Nt-size:12px;font-family:arial, Helvetica, Sans-serif; padding:5px } </style> <div class= "Mainbox" > <a href= "#" class= "Edit_link" Title= "Edit" >Edit</a> <?php include ("db.php"); $sql =mysql_query ("Select email from Users where user_id= ' 1 '); $row =mysql_fetch_array ($sql); $profile = $row [' Email ']; ?> < Div class= "Text_wrapper" style= "><?php echo $profile;?></div> <div class=" edit "style= "DisplaY:none "><textarea class=" EditBox "cols=" rows= "3" name= "Profile_box" ></textarea></div> </div> update_profile_ajax.php code as follows: <?php if ($_post[' data ') { $data =$_post[' data ']; $data = mysql_escape_string ($data); $sql = "Update users set email=" $dat A ' where user_id= ' 1 ' "; mysql_query ($sql); } ?>