½â¾öajaxÒÔpost·½Ê½´«²Îʱ£¬×Ö·û´®ÖÐÓе¥ÒýºÅµÄ´íÎó¡£
½ñÌìÓÃajaxµÄpost·½Ê½´«ÖµÊ±£¬Óöµ½Ò»¸öÎÊÌ⣬ʼÖÕûÓÐÕÒµ½ÎÊÌâÔÒò¡£ºóÀ´°Ñ´«µÄÖµÖе¥ÒýºÅÈ¥µôºó£¬jsÕý³£ÁË¡£
¾¹ýËÑË÷£¬Ò²Ã»ÓÐÕÒµ½¾ßÌåÔÒò¡£×îºóͨ¹ýÒþ²ØÓòÀ´ÖÐת¸Ã×Ö·û´®¡£×îºó½â¾öÕâ¸öÎÊÌ⣡ÎÞÓïÁË£¡±¸Íü£¡
js²¿·Ý£º
////Òì²½µ÷Ó÷þÎñÆ÷ÐÅÏ¢
function CallServiceInsert()
{
var url="";
var param = "";
var sql = document.getElementById("hidSQL").value; //sqlÓï¾äÖÐÓе¥ÒýºÅ£¬Èç¹ûÖ±½Ó´«²Î»á±¨´í¡£
url = "../ajax/ajaxDelOrInsert.ashx";
param = "strsql=" + sql;
sendRequestPost(url, param,0);
}
ǰ̨²¿·Ý£º
<asp:HiddenField ID="hidSQL" runat="server" />
<div class="LoadingMsg" id="LoadingMsg" style="display: none; z-index: 110; height: 20px; position: absolute;top: 10px;">
<img src="../images/ico/trans-done.png" mce_src="images/ico/trans-done.png" style="vertical-align: middle;" mce_style="vertical-align: middle;"> <span id="ShowMsg"></span>
</div>
ºǫ́²¿·Ý£º
sql = "´Ë´¦·ÅÖÃsqlÓï¾ä";
hidSQL.Value = sql;
sssDB.FunctionForButton(btnSaveAll, "CallServiceInsert();");
Ò»°ãʼþ´¦Àí ajaxDelOrInsert.ashx
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
//context.Response.Write("Hello World");
string retStr = "";
//get·½Ê½
//string strUserName = context.Request.QueryString[0];
//post·½Ê½
string sql = context.Request.Params["strsql"];
int ret = 0;
ret=sssDB.InsertOrUpdate(sql);
if (ret == 0)
{
retStr = "²Ù×÷ʧ°Ü";
}
else
retStr = "²Ù×÷"+ret.ToString()+"ÌõÊý¾Ý³É¹¦";
context.Response.Write(retStr);
}
Ïà¹ØÎĵµ£º
tree.js
function getRank(rankNum)
{
var rankName="";
switch(rankNum)
{
case 1:
{
rankName="(ÆÕͨ»áÔ±)";
break;
}
case 2:
{
&n ......
ÔÎĵØÖ·¡¿Announcing the Microsoft AJAX CDN
¡¾ÔÎÄ·¢±íÈÕÆÚ¡¿ Tuesday, September 15, 2009 11:46 PM
½ñÌìÔçЩʱºò£¬ASP.NET¿ª·¢ÍŶÓÍƳöÁËÒ»¸öеÄ΢ÈíAjax CDN£¨Content Delivery Network£¬ÄÚÈÝ·Ö·¢ÍøÂ磩·þÎñ£¬¸Ã·þÎñÌṩÁ˶ÔAJAX¿â£¨°üÀ¨jQuery ºÍ ASP.NET AJAX£©µÄ»º´æÖ§³Ö¡£¸Ã·þÎñÊÇÃâ·ÑµÄ£¬²»ÐèÈκÎ×¢² ......
ʵÏÖ×¢²á½çÃæÎÞË¢ÐÂÅжÏÖØÃû£¬ÓÉÓÚÒª·ÃÎÊÊý¾Ý¿â£¬ËùÒÔÒª´ïµ½ÎÞˢУ¬Ö»ÄÜÓÃAjax¼¼Êõ¡£
ÆäÖÐ×îÖØÒªµÄ¾ÍÊÇxmlHttp¶ÔÏó¡£
XmlHttpÊÇʲô£¿
×îͨÓõĶ¨ÒåΪ£ºXmlHttpÊÇÒ»Ì׿ÉÒÔÔÚJavascript¡¢VbScript¡¢JscriptµÈ½Å±¾ÓïÑÔÖÐͨ¹ýhttpÐÒé´«ËÍ»ò´Ó½ÓÊÕXML¼°ÆäËûÊý¾ÝµÄÒ»Ì×API¡£XmlHttp×î´óµÄÓô¦ÊÇ¿ÉÒÔ¸üÐÂÍøÒ³µ ......
ÏÈÀ´Ð´Ò»¸ö¼òµ¥µÄAjax³ÌÐò£¬Ê¹Ó÷Çͬ²½µÄ·½Ê½Ïò·þÎñÆ÷¶ËÈ¡µÃTXTÎļþÖеÄÄÚÈÝ£¬²¢¼ÓÒÔÏÔʾ¡£Ê×ÏÈ£¬Çë×¼±¸Ò»¸öHelloAjax.aspx(HTMLÒ²¿É)£º
*HelloAjax.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HelloAjax.aspx.cs" Inherits="HelloAjax._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD ......