网络编程
位置:首页>> 网络编程>> JavaScript>> jquery AJAX 三个发送状态 posting, error, success

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

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

标签:Javascript,jQuery,AJAX


<!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>

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com