.net ƽ̨µÄC#ʵÏÖAjax——ÎÞÐèÈκοò¼Ü¡£
1.´´½¨WEB Application¹¤³ÌWebAjax¡£
2.½¨Á¢Ä¿Â¼ÎļþAjaxCommon.jsÈçÏ£º
// ÉùÃ÷XmlHttpRequest³ÉÔ±±äÁ¿
var xmlHttpReq_Obj = null;
// ³õʼ»¯»ñÈ¡XmlHttpRequest¶ÔÏó
///<param>handler :»Øµ÷º¯ÊýÃû</param>
function GetXmlHttpObject(handler) {
var xmlHttpObj = null;
try {
// Microsoft
xmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP");
// ÉèÖûص÷º¯Êý
if(xmlHttpObj != null) {
xmlHttpObj.onreadystatechange = handler;
}
} catch (e){
try
{
// Mozilla | Netscape | Safari
xmlHttpObj = new XMLHttpRequest();
// ÉèÖûص÷º¯Êý
if(xmlHttpObj != null) {
xmlHttpObj.onload = handler;
xmlHttpObj.onerror = handler;
}
} catch (e) {
}
}
if(xmlHttpObj == null) {
alert("Error initialing XMLHttpRequest!");
}
return xmlHttpObj;
}
// ·¢ËÍÇëÇó
///<param>xmlHttpObj :XmlHttpObject¶ÔÏó</param>
///<param>url :ÇëÇóurl</param>
function SendXmlHttpRequest(xmlHttpObj,url) {
xmlHttpObj.open('GET', url, true);
xmlHttpObj.send(null);
}
// Ö´Ðлص÷º¯Êý
///<param>handler :»Øµ÷º¯ÊýÃû</param>
///<param>url :ÇëÇóurl</param>
function ExecuteCall(handler, url) {
try{
xmlHttpReq_Obj = GetXmlHttpObject(handler);
SendXmlHttpRequest(xmlHttpReq_Obj, url);
} catch (e){
}
}
3.½¨Á¢ÎļþAjaxBlankPage.aspx×÷ΪAjax·þÎñ¶Ë´¦ÀíÊý¾ÝPage
AjaxBlankPage.aspxÄÚÈÝΪ£º
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AjaxBlankPage.aspx.cs" Inherits="WebAjax.AjaxBlankPage" %>
ɾ³ýÆäËûËùÓм´¿É
AjaxBlankPage.aspx.csÄÚÈÝΪ£º
using System;
using System.Data.OleDb;
using System.Data;
using System.Text;
using AkCommon.Common.Conn;
using AkCommon.Common.Log;
namespace WebAjax
{
/// <summary>
/// ´¦Àí¸ÅÒª
/// </summary>
/// <remarks>
/// <para>DATE £º2009/07/20</para>
/// <para>AUTHOR£ºTHINKINGALL</para>
/// &
Ïà¹ØÎĵµ£º
¿´¿´ Ajax ºÍ DOM ½Å±¾±à³Ì¾¿¾¹Óжà¼òµ¥
ÎĵµÑ¡Ïî
½«´ËÒ³×÷Ϊµç×ÓÓʼþ·¢ËÍ
¼¶±ð£º Öм¶
Jesse Skinner, Web ¿ª·¢ÈËÔ±, Freelance
2007 Äê 5 ÔÂ 16 ÈÕ
jQuery ÊÇÒ»¸öJavaScript ¿â£¬ËüÓÐÖúÓÚ¼ò»¯ JavaScript™ ÒÔ¼° Asynchronous JavaScript + XML (Ajax) ±à³Ì¡£ÓëÀàËÆµÄ JavaScript ¿â²»Í¬£¬jQuery ¾ßÓжÀ ......
´ÓÊý¾Ý¿âmyÖеÄusernameÓû§±íÀïÑéÖ¤£º
checkusername.html£º
<!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" conte ......
Case I. Web´úÀíµÄ·½Ê½ (on Server A)
¼´Óû§·ÃÎÊAÍøվʱËù²úÉúµÄ¶ÔBÍøÕ¾µÄ¿çÓò·ÃÎÊÇëÇó¾ùÌá½»µ½AÍøÕ¾µÄÖ¸¶¨Ò³Ã棬ÓɸÃÒ³Ãæ´úÌæÓû§Ò³ÃæÍê³É½»»¥£¬´Ó¶ø·µ»ØºÏÊʵĽá¹û¡£´Ë·½°¸¿ÉÒÔ½â¾öÏֽ׶ÎËùÄܹ»Ïëµ½µÄ¶àÊý¿çÓò·ÃÎÊÎÊÌ⣬µ«ÒªÇóAÍøÕ¾ÌṩWeb´úÀíµÄÖ§³Ö£¬Òò´ËAÍøÕ¾ÓëBÍøÕ¾Ö®¼ä±ØÐëÊǽôÃÜÐ×÷µÄ£¬ÇÒÿ´Î½»»¥¹ý³Ì£¬AÍøÕ¾µÄ· ......
PHP 5.2 ¼°ÒÔÉÏ°æ±¾ÌṩÁË json_encode ºÍ json_decode º¯Êý£¬Ï൱ºÃÓá£
¶ø֮ǰµÄ°æ±¾ÔòÐèÒªÏÂÔØÍøÓÑÃÇ×ÔÐпª·¢µÄ¿â£¨ÓÐÐËȤµÄ¿ÉÒÔ¿´Ï http://code.itlearner.com/php/JSON-class.html £©
¿ÉÒԲο¼ÈçÏÂÕâ¸ö·½·¨À´ÔڵͰ汾ÉÏÀ©³äÕâÁ½¸öº¯Êý£º
if (!function_exists('json_encode') && !function_exists('j ......
AJAXʵÏÖ¶þ¼¶¼¶Áª²Ëµ¥£¬ÓÃPHPÍê³É£¬¿Í»§¶Ë´úÂ룺
<!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 ......