易截截图软件、单文件、免安装、纯绿色、仅160KB

jQuery Ajax 全解析

jQuery Ajax 全解析
本文短址:http://s8.hk/0itq
<!--
.ajax div{
border: solid 1px red;
}
-->
// <![CDATA[
$(function(){

$("#btnajax").click(function(){
$.ajax({
type: "get",
url: "/rss",
beforeSend: function(XMLHttpRequest){
$('<div class="quick-alert">数据加载中,请稍后</div>')
.insertAfter( $("#btnajax") )
.fadeIn('slow')
.animate({opacity: 1.0}, 3000)
.fadeOut('slow', function() {
$(this).remove();
});
},
success: function(data, textStatus){
$(".ajax.ajaxResult").html("");
$("item",data).each(function(i, domEle){
$(".ajax.ajaxResult").append("<li>"+$(domEle).children("title").text()+"</li>");
});
},
complete: function(XMLHttpRequest, textStatus){
//HideLoading();
},
error: function(){
//请求出错处理
}
});
});
$("#btngetScript").click(function(){
$(this).attr("disabled","true");
$.getScript("http://files.cnblogs.com/QLeelulu/AjaxEvent.js", function(){
alert("AjaxEvent.js 加载完成并执行完成.你再点击上面的Get或Post按钮看看有什么不同?");
$("#btnremoveScript").attr("disabled","");
});
});
$("#btnremoveScript").click(function(){
$(this).attr("disabled","true");
$("#btngetScript").attr("disabled","");
$("body").unbind();
});
$("#btnpost").click(function(){
$.post("http://qleelulu.atx41.idc800.net/jQuery/Ajax.aspx", { Action: "post", Name: "lulu" },
function (data, textStatus){
// data 可以是 xmlDoc, jsonObj, html, text, 等等.
//this; // 这个Ajax请求的选项配置信息,请参考jQuery.g


相关文档:

jquery、Ajax、struts的集成

Html代码:
<%@ page language="java" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>jquery ajax</title>
  <link rel="stylesheet" type="text/css" media="screen"
  ......

Ajax add_pageLoaded

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
/// <summary>
/// Summary description for Commen ......

ajax 安全性

完全适用ASP.NET的认证机制
–可以使用FormsAuthentication
•WebService方法可以操作Cookie
–Impersonation
–PrincipalPermission
WebService7.cs Code
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
usi ......

Ajax 错误处理

错误处理
•调用时可以提供一个额外的错误回调函数
•包括超时和服务器端抛出的异常
•超时只能设置在WebService级别
–或者设置在PageMethods对象上
–无法在每个MethodCall时指定
•Sys.Net.WebServiceError
–timedout、message、exceptionType、stackTrace属性
ErrorHandling.a ......

Ajax 客户端代理的作用

客户端代理的作用
在对象里做了一个标记
–“__type” = “ComplexType.Color”
服务器端根据标记选择反序列化的目标类型
可出现“多态”效果
Employee.cs Code:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Secu ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号