AJAX ScriptManagerProxyµ÷ÓÃwebservice
ÄÚÈÝÒ³£º
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ScriptManagerProxyDemo.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script type="text/javascript">
function EchoUserInput() {
var echoElem = $get("EnteredValue");
alert(echoElem);
ScriptManagerProxyDemo.WebService1.EchoInput(echoElem.value, OnSucceeded);
}
function OnSucceeded(result)
{
var RsltElem = $get("Results");
RsltElem.innerHTML=result;
}
</script>
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<Services>
<asp:ServiceReference Path="~/WebService1.asmx" />
</Services>
</asp:ScriptManagerProxy>
<input type="text" id="EnteredValue" /><input type="button" onclick="EchoUserInput()"/>
<div id="Results"></div>
</asp:Content>
webservice£º
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace ScriptManagerProxyDemo
{
/// <summary>
/// WebService1 µÄժҪ˵Ã÷
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile
Ïà¹ØÎĵµ£º
Ò»¡¢ÇáËÉÕÆÎÕAjax.netϵÁн̳ÌÒ»£º²¿ÊðAJAX.NEThttp://hi.baidu.com/welllxy001/blog/item/9fd331cadcbdff8cc8176828.html
¶þ¡¢ÇáËÉÕÆÎÕAjax.netϵÁн̶̳þ£º²¿ÊðAjax Control Toolkithttp://hi.baidu.com/welllxy001/blog/item/17f8fd8271c288a80df4d229.html ......
asp.net ajaxÖÐÎÄÂÒÂëµÄ½â¾ö£¿
2010-01-19 12:06
ÒÔǰûÔõô×ÐϸµÄÑо¿¹ýajax,Ö»ÊÇÓõ½Á˾ÍÖ±½ÓÄùýÀ´ÓÃ,·¢ÏÖÁËÎÊÌâÔÙÕÒ½â¾ö·½·¨.ÒÔÏÂÊÇÎÒÔÚÕÒ½â¾öÎÊÌâµÄ¹ý³ÌÖеÄÒ»µãССµÄ×ܽá.
Ò».̸AjaxµÄGetºÍPostµÄÇø±ð
Get·½Ê½:
ÓÃget·½Ê½¿É´«Ëͼòµ¥Êý¾Ý£¬µ«´óСһ°ãÏÞÖÆÔÚ1KBÏ£¬Êý¾Ý×·¼Óµ½urlÖз¢Ë ......
1) TextboxList×Ô¶¯Íê³É £¨Ô´Â룬ÑÝʾ£©
Õâ¸ö¿Ø¼þÖ÷ÒªÀ´×ÔFacebook°É£¬ÔÚÍøÒ×µÄÓʼþÀïÒ²ÄÜ¿´µ½£¬»¹ÓÐhotmailµÈµÈ£¬ÔÚÎı¾¿òÀïÊäÈëÎı¾²»µ«¿ÉÒÔ³öÏÖÏà¹ØÊý¾ÝµÄÁÐ±í£¬¶øÇÒÑ¡ÖкóµÄ×Ö·û´®»¹»á±ä³ÉÒ»¸öСͼ±ê¡£Õâ¸ö¿Ø¼þÖ÷ÒªÓÃÔÚµç×ÓÓʼþÖаɡ£
2) Ajax IM¼´Ê±ÁÄÌì £¨Ô´Â룬ÑÝʾ£©
Ajax IMÊÇÒ»¸öºÜÅ£µÄ¼´Ê±ÁÄÌìµÄ¿Í»§¶Ë£¬Äã ......
ÎÒÃÇ¿ÉÒÔʹÓÃXML×÷ΪÊý¾Ý´«ËÍ¡¢¹µÍ¨µÄ¸ñʽ£¬Ajax¿Í»§¶ËÈôÒª·¢ËÍXML£¬»ù±¾ÉϾÍÊǽ«XML×÷Ϊ×Ö·û´®£¬ÔÚPOSTÇëÇóʱ·¢ËÍ£¬ÀýÈ磺
*HelloAjax.js
view plaincopy to clipboardprint?
var xmlHttp;
function createXMLHttpRequest() {
if (window.XMLHttpRequest) {   ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" media="all" href="css/style.css" />
<meta http-equiv="Content-Type" content="text/html; ......