jquery AJAX 三个发送状态 posting, error, success

时间:2010-07-31 18:59:00 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>shawl.qiu template</title>
<script type='text/javascript' src='/js/jquery/jquery-latest.js'></script>
</head>
<body>

<script type="text/javascript">
/*<![CDATA[*/

$.ajax
(
 {
  type:"GET"
  , cache: false
  , url: "/"
  , beforeSend:
   function(XMLHttpRequest, textStatus)
   {
    $('<div>posting</div>').appendTo('body');
   }
  , error:
   function(XMLHttpRequest, textStatus, errorThrown)
   {
    $('<div>error</div>').appendTo('body');
    alert('ok');
   }
  , success:
   function(data_)
   {
    $('<div>success</div>').appendTo('body');
   }
 }
);/* $.ajax */

$.ajax
(
 {
  type:"GET"
  , cache: false
  , url: "/nopath/"
  , beforeSend:
   function(XMLHttpRequest, textStatus)
   {
    $('<div>posting</div>').appendTo('body');
   }
  , error:
   function(XMLHttpRequest, textStatus, errorThrown)
   {
    $('<div>error</div>').appendTo('body');
    alert('ok');
   }
  , success:
   function(data_)
   {
    $('<div>success</div>').appendTo('body');
   }
 }
);/* $.ajax */

/*]]>*/
</script>
</body>
</html>

标签:Javascript,jQuery,AJAX
0
投稿

猜你喜欢

  • python下实现二叉堆以及堆排序的示例

    2023-02-19 16:44:23
  • Pytorch中torch.argmax()函数使用及说明

    2021-11-24 14:49:31
  • 搜索历史基本原理实现即时自动补全联想搜索技巧

    2023-05-31 22:02:04
  • JupyterLab远程密码访问实现

    2022-06-04 23:52:26
  • YiiFramework入门知识点总结(图文教程)

    2023-11-20 18:41:03
  • asp无组件备份与还原数据库

    2007-09-24 13:19:00
  • Python Process多进程实现过程

    2021-04-30 02:21:45
  • Python使用SQLite和Excel操作进行数据分析

    2023-11-27 22:32:28
  • 网页开发中的容易忽略的问题 javascript HTML中的table

    2023-09-04 20:43:52
  • iscroll碰到Select无法选择下拉刷新的解决办法

    2024-05-11 09:33:35
  • SQL Server数据库实用小技巧集合

    2008-11-25 11:35:00
  • HTTP Headers 傻瓜教程[译]

    2010-01-25 12:48:00
  • python用turtle库绘画圣诞树

    2023-05-24 19:35:40
  • PHP7新特性foreach 修改示例介绍

    2024-06-05 09:23:48
  • 使用SQL语句将相同名的多行字段内容拼接(方法详解)

    2024-01-15 00:11:13
  • SQL Server的BUILTIN\\Administrators用户

    2009-02-04 13:51:00
  • 基于python实现图片转字符画代码实例

    2023-05-17 01:53:37
  • Python反射和内置方法重写操作详解

    2023-07-06 12:00:02
  • 2008年个性设计挂历参考

    2007-12-29 20:30:00
  • 深入了解Golang官方container/heap用法

    2024-05-13 10:44:42
  • asp之家 网络编程 m.aspxhome.com