Animated Ajax Record Deletion Using jQuery (Jquery ajax 删除记录)
2009-07-24 09:51
531 查看
<style type="text/css">
.record { padding:10px 20px; background:#eee; border-top:1px solid #ccc; width:300px; } .delete { color:#f00; display:block; width:40px; float:right; }</style>
<script type="text/javascript" src="http://davidwalsh.name/dw-content/jquery-1.3.2.js"></script>
<script type="text/javascript" src="http://davidwalsh.name/dw-content/jquery.color.js"></script>
<script type="text/javascript">
$(document).ready(function() { $('a.delete').click(function(e) { e.preventDefault(); var parent = $(this).parent(); $.ajax({ type: 'get', url: 'jquery-record-delete.php', data: 'ajax=1&delete=' + parent.attr('id').replace('record-',''), beforeSend: function() { parent.animate({'backgroundColor':'#fb6c6c'},300); }, success: function() { parent.slideUp(300,function() { parent.remove(); }); } }); }); });</script>
<div class="record" id="record-1">
<a href="?delete=1" class="delete">Delete</a>
<strong>Database Item 1</strong>
</div>
<div class="record" id="record-2">
<a href="?delete=2" class="delete">Delete</a>
<strong>Database Item 2</strong>
</div>
Demo: http://davidwalsh.name/dw-content/jquery-record-delete.php
another: http://davidwalsh.name/animated-ajax-record-deletion-mootools
相关文章推荐
- Animated Ajax Record Deletion Using jQuery
- 使用Jquery的ajax方式实现对表格的删除和修改
- Using AJAX with JQuery Mobile
- <记录>Jquery + TP +Ajax 验证用户名是否注册
- MVC jquery ajax 批量删除数据
- jQuery的$.ajax()与php后台交互,进行图片上传并删除
- ORA-02292:integrity constraint(xx) violated - child record found 外键关联,无法删除记录
- jquery ajaxSubmit 一点记录
- AJAX with JSP and Servlet using Jquery Example
- jQuery如何动态删除TR,input按钮删除本行记录,checkbox全选反选
- 记录IIS7上配置.Net2010的mvc2遇到的jQuery关于ie的Ajax小问题..
- Rendering a simple ASP.NET MVC PartialView using JQuery Ajax Post call
- 转 Using $.ajaxPrefilter() To Configure AJAX Requests In jQuery 1.5
- 关于Ajax ,jQuery以及jQuery Ajax 编程 (一)
- 关于Ajax ,jQuery以及jQuery Ajax 编程 (四)
- 关于Ajax ,jQuery以及jQuery Ajax 编程 (五)
- jquery中ajax如何返回值到上层函数的方法以及对于js处理json对象方法的记录
- Using jQuery for AJAX in ASP.NET
- 使用Jquery的Ajax实现无刷新更新,修改,删除页面
- [问题记录]JQuery的AJAX,参数内容