Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Ajax ´íÎó´¦Àí

´íÎó´¦Àí
•µ÷ÓÃʱ¿ÉÒÔÌṩһ¸ö¶îÍâµÄ´íÎó»Øµ÷º¯Êý
•°üÀ¨³¬Ê±ºÍ·þÎñÆ÷¶ËÅ׳öµÄÒì³£
•³¬Ê±Ö»ÄÜÉèÖÃÔÚWebService¼¶±ð
–»òÕßÉèÖÃÔÚPageMethods¶ÔÏóÉÏ
–ÎÞ·¨ÔÚÿ¸öMethodCallʱָ¶¨
•Sys.Net.WebServiceError
–timedout¡¢message¡¢exceptionType¡¢stackTraceÊôÐÔ
ErrorHandling.asmx Code:
<%@ WebService Language="C#" Class="ErrorHandling" %>
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Threading;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class ErrorHandling : System.Web.Services.WebService
{
[WebMethod]
public int GetDivision(int a, int b)
{
return a / b;
}
[WebMethod]
public int Timeout()
{
Thread.Sleep(5000);
return 0;
}
}
3_ErrorHandling.aspx Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="3_ErrorHandling.aspx.cs" Inherits="_3_ErrorHandling" %>
<!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 runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="ErrorHandling.asmx" />
</Services>
</asp:ScriptManager>

<input type="button" value="getDivision" onclick="getDivision(5, 0)" />
<input type="button" value="timeout" onclick="timeout()" />

<mce:script language="javascript" type="text/javascript"><!--
function getDivision(a, b)
{
ErrorHandling.GetDivision(a, b, null, failedCallback);
}

function timeout()
{
ErrorHandling.set_timeout(2000);
ErrorHandling.Timeout(null


Ïà¹ØÎĵµ£º

Ïê½âAJAXºËÐÄÖеÄXMLHttpRequest¶ÔÏó

XMLHttpRequest ¶ÔÏóÊÇAJAX¹¦ÄܵĺËÐÄ£¬Òª¿ª·¢AJAX³ÌÐò±ØÐë´ÓÁ˽âXMLHttpRequest ¶ÔÏó¿ªÊ¼¡£
¡¡¡¡Á˽âXMLHttpRequest ¶ÔÏó¾ÍÏÈ´Ó´´½¨XMLHttpRequest ¶ÔÏó¿ªÊ¼£¬ÔÚ²»Í¬µÄä¯ÀÀÆ÷Öд´½¨XMLHttpRequest ¶ÔÏóʹÓò»Í¬µÄ·½·¨£º
¡¡¡¡ÏÈ¿´¿´IE´´½¨XMLHttpRequest ¶ÔÏóµÄ·½·¨(·½·¨1)£º
¡¡¡¡var xmlhttp = new ActiveXObject(" ......

jquery AJAXÓ¦ÓÃ

load(url[,data][,callback])------------->ͨ³£ÓÃÀ´´ÓWEB·þÎñÆ÷ÉÏ»ñÈ¡¾²Ì¬µÄÊý¾ÝÎļþ
url: stringÀàÐÍ ÇëÇóHTMLÒ³ÃæµÄURLµØÖ·
data(¿ÉÑ¡): object ·¢ËÍÖÁ·þÎñÆ÷µÄkey/valueÊý¾Ý
callback(¿ÉÑ¡):function ÇëÇóÍê³Éʱ»Øµ÷º¯Êý
Àý×Ó£º
Ö÷Ò³Ãæ´úÂ룺
<style type="text/css">
* { margin:0; padding ......

AJAX¼¼ÊõÈëÃÅÖ¸µ¼

ʲôÊÇ AJAX?
¡¡¡¡AJAX (Òì²½ JavaScript ºÍ XML) ÊǸöвúÉúµÄÊõÓï,רΪÃèÊöJavaScriptµÄÁ½ÏîÇ¿´óÐÔÄÜ.ÕâÁ½ÏîÐÔÄÜÔÚ¶àÄêÀ´Ò»Ö±±»ÍøÂ翪·¢ÕßËùºöÂÔ,Ö±µ½×î½üGmail, Google suggestºÍgoogle MapsµÄºá¿Õ³öÊÀ²ÅʹÈËÃÇ¿ªÊ¼Òâʶµ½ÆäÖØÒªÐÔ.
¡¡¡¡ÕâÁ½Ïî±»ºöÊÓµÄÐÔÄÜÊÇ:
¡¡¡¡ÎÞÐèÖØÐÂ×°ÔØÕû¸öÒ³Ãæ±ãÄÜÏò·þÎñÆ÷·¢ËÍÇëÇó.
¡¡¡ ......

ʹÓÃjQuery¼ò»¯Ajax¿ª·¢——Ajax¿ª·¢ÈëÃÅ

jQueryÊÇÒ»¸ö¿ÉÒÔ¼ò»¯ JavaScript?ÒÔ¼°AJAX£¨Asynchronous JavaScript
+XML£¬Òì²½JavascriptºÍXML£©±à³ÌµÄJavascript¿â¡£²»Í¬ÓÚÆäËûµÄJavascript¿â£¬jQueryÓÐËû×Ô¼ºµÄÕÜѧ£¬Ê¹Äã¿É
ÒԺܼòµ¥µÄ±àд´úÂë¡£ÕâƪÎÄÕ¾ͻá´øÁìÄã¼ûʶһÏÂjQueryµÄÕÜѧ£¬Ì½ÌÖÒ»ÏÂËûµÄÌØÐÔÒÔ¼°¹¦ÄÜ£¬²¢ÇÒ»á×öһЩajaxµÄʾÀý£¬ÒÔ¼°ÈçºÎʹÓÃplug-
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ