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>