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

jQuery AJAX»Øµ÷º¯ÊýthisÖ¸ÏòÎÊÌâ

Á˽âJavaScriptµÄÈ˶¼ÖªµÀJavaScriptµÄthis²»×ÜÊÇÖ¸Ïòµ±Ç°¶ÔÏ󣬺¯Êý»òÀàÖеÄthisÖ¸ÏòÓëµ÷ÓÃÕâ¸öº¯ÊýµÄ¶ÔÏóÒÔ¼°ÉÏÏÂÎÄ»·¾³ÊÇϢϢÏà¹ØµÄ¡£ÈçÔÚÈ«¾Ö×÷ÓÃÓòµ÷ÓÃÒ»¸öº¬thisµÄ¶ÔÏ󣬴Ëʱµ±Ç°¶ÔÏóµÄthisÖ¸ÏòµÄÊÇwindow¡£ÎªÁËÈÃthisµÄÖ¸Ïò·ûºÏ×Ô¼ºµÄÒâÔ¸£¬JavaScriptÌṩÁËÁ½¸ö·½·¨ÓÃÒԸıäthisµÄÖ¸Ïò£¬ËüÃÇÊÇcallºÍapply£¬µ±È»Ò²ÓÐÀûÓñհüÀ´ÊµÏֵķ½·¨¡£±¾ÎÄͨ¹ýÒ»¸öÀý×ÓÀ´ËµÃ÷ÕâЩÎÊÌâ¡£
ÏÈ¿´Ò»¶ÎÑÝʾ´úÂ룬Õâ´úÂëÖ»¹©ÑÝʾÓã¬Ã»ÓÐʵ¼ÊÒâÒå¡£
//Ò»¸öûÓÐʵ¼ÊÒâÒåµÄsocketÁ¬½Ó¶ÔÏó
var socket = 
{
    connect: function(host, port)
    {
        alert('Connecting socket server,host:' + host + ',port:' + port);
    }
};
//Ò»¸ö¼´Ê±Í¨Ñ¶À࣬ÆäÖÐconnect·½·¨»¹½«×÷ΪAJAX»Øµ÷º¯Êý±»µ÷ÓÃ
function classIm()
{
    this.host = '192.168.1.28';
    this.port = '8080';
    this.connect = function(data)
    {
        socket.connect(this.host, this.port);
    };
}
//ʵÀý»¯¼´Ê±Í¨Ñ¶Àà
var IM = new classIm();
//AJAXÇëÇó£¬ÕâÀï¼ÙÉèÒª´ò¿ªsocketÁ¬½ÓÊ×ÏÈҪͨ¹ýWEBµÃÖªÓû§WEBµÇ¼³É¹¦
$.get('CheckWebLogin.aspx', IM.connect);
ÔËÐÐÉÏÃæµÄÀý×Ó£¬Ä㽫¿´µ½µ¯³öµÄhostÓëport¶¼ÊÇundefined£¬ÄÇÊÇÒòΪ»Øµ÷º¯ÊýµÄthis²»ÊÇÖ¸ÏòIM¶ÔÏ󣬶øÊÇjQueryµÄAJAXÅäÖöÔÏóajaxSettings¡£ÔÚjQueryÄÚ²¿ÊÇÓÃs.success´úÌæ´«ÈëµÄ»Øµ÷º¯ÊýÈ¥Ö´Ðеģ¬¶øsuccessµÄµ÷ÓöÔÏó¾ÍÊÇs£¬¼´ÏÂÃæajaxSettings¶ÔÏóµÄËõд¡£
ajaxSettings: 
{
    url: location.href,
    global: true,
    type: "GET",
    contentType: "application/x-www-form-urlencoded",
    processData: true,
    async: true
}
ΪÁËÖ¤Ã÷ÕâÒ»µã£¬Äã¿ÉÒÔÕâÑùÐ޸ĴúÂë²âÊÔһϣ¬Ä㽫¿´µ½ÊÇurl¡¢glo


Ïà¹ØÎĵµ£º

Ajax ¸´ÔÓÊý¾ÝÀàÐÍʹÓûù´¡

¸´ÔÓÊý¾ÝÀàÐÍʹÓûù´¡
•¹«ÓÐÊôÐÔ»ò¹«ÓÐField»á±»ÊͷźͽÓÊÜ
•ÈÝÆ÷¶ÔÏó
–ʵÏÖIList½Ó¿ÚµÄ¶ÔÏó
–ʵÏÖIDictionary½Ó¿ÚµÄ¶ÔÏó
•Key±ØÐëÊÇString
WebService2.cs Code£º
using System;
using System.Collections;
using System.Web;
using System.Web.Services;
using System.Web.Service ......

ASP.NET»ùÓÚJQUERYµÄAJAXµÄÑéÖ¤µÇ¼£¨JSON£©

Default.aspx
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default"%>
<!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" & ......

Ajax ½ø¶ÈÌõÉèÖã¨UpdateProgress£©

<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="act" %>
<mce:style type="text/css"& ......

AjaxÐÅÏ¢·´À¡ÏÔʾ

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0044)http://www.qqip.cn -->
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>new document</TITLE>
<META ht ......

AJAX³õ²½

µÚ   1   ²¿·Ö:   Ajax   ¼ò½é  
Ajax   ÓÉ   HTML¡¢JavaScript¡¢DHTML   ºÍ   DOM   ×é³É£¬ÕâÒ»½Ü³öµÄ·½·¨¿ÉÒÔ½«±¿×¾µÄ   Web   ½çÃæת»¯³É½»»¥Ð﵀   Ajax   Ó¦ÓóÌÐò¡£±¾ÎĵÄ×÷ÕßÊÇһλ   Ajax   ר¼Ò£¬ËûÑÝʾÁËÕâЩ¼¼ÊõÈçºÎЭͬ¹¤× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ