类似facebook无刷新ajax更新
演示
XML/HTML Code
- <script type="text/java script">
- $(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();
- });
- });
-
- Edit
- include("db.php");
- $sql=mysql_query("select email from users where user_id='1'");
- $row=mysql_fetch_array($sql);
- $profile=$row['email'];
- >
-