c#ÖеÄAjaxÉÏÊÖƪ£££·Çͬ²½ÇëÇóresponseXML
ÉÏƪ½éÉÜÁËÈçºÎÔÚAjax¿Í»§¶ËÓë·þÎñÆ÷¶ËÖ®¼ä´«Ëͼòµ¥µÄÎı¾Êý¾Ý£¬Æäʵ£¬Ò²¿ÉÒÔʹÓÃXML×÷ΪÊý¾Ý´«ËÍ¡¢¹µÍ¨µÄ¸ñʽ£¬Ajax¿Í»§¶ËÈôÒª·¢ËÍXML£¬»ù±¾ÉϾÍÊǽ«XML×÷Ϊ×Ö·û´®£¬ÔÚPOSTÇëÇóʱ·¢ËÍ£¬ÀýÈ磺
*HelloAjax.js
var xmlHttp;
function createXMLHttpRequest() {
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
function prepareXML() {
var xml = "<skills>";
var options = document.getElementById("skills").childNodes;
for (var i = 0; i < options.length; i++) {
var option = options[i];
if (option.selected) {
xml = xml + "<skill>" + option.value + "<\/skill>";
}
}
xml = xml + "<\/skills>";
return xml;
}
function handleSkills() {
var xml = prepareXML();
var url = "Handler1.ashx?timeStamp=" + new Date().getTime();
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("POST", url);
xmlHttp.setRequestHeader("Content-Type", "text/xml");
xmlHttp.send(xml);
}
ÔÚÉÏÀýÖУ¬½«¿Í»§¶ËÔÚ¶àÑ¡ÔñÏÂÀ¿òÖÐÑ¡ÔñµÄÊý¾Ý£¬ÒÔÏÂÁеÄXML¸ñʽ·¢ËÍ£º
<skills>
<skill>java</skill>
<skill>vb</skill>
<skill>csharp</skill>
</skills>
·þÎñÆ÷¶Ë²ÉÓÃHttpHandlerʵÏÖ£¬ÔÚ·þÎñÆ÷¶Ë½ÓÊÕµ½XMLÖ®ºó£¬Õë¶ÔXML¼ÓÒÔÆÊÎö£¬È¡µÃÿ¸öNODEÊý¾Ý¡£
²¢»áÒÔÁíÒ»¸öXMLÎļþÖØз¢»Ø¿Í»§¶Ë¡£
*Hanler1.ashx
using System.Text;
using System.Web;
using System.Xml;
using System.Globalization;
namespace HelloAjax
{
public class Handler1 : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
HttpRequest Request = context.Request;
HttpResponse Response = context.Response;
if (Request.InputStream.Length != 0)
Ïà¹ØÎĵµ£º
SQLiteÊÇÒ»¸ö¾«ÇɵÄÇáÁ¿¼¶Êý¾Ý¿â£¬½ñÌìÖÕÓÚ»ù±¾ÕÆÎÕÁËÈçºÎÓÃC#²Ù×÷SQLiteÊý¾Ý¿â¡£¸ù¾ÝÍøÓÑÃǵľÑ飬ÖÁÉÙÓÐÁ½ÖÖ·½·¨¿ÉÒÔ×öµ½SQLiteµÄµ÷Óã¬Ò»ÖÖÊǵ÷ÓÃsqlite3.dll£¬Ò»ÖÖÊÇÓÃSystem.Data.SQLite£¬¼´sqlite.ADO.NET,ÊÇרΪC sharp·â×°µÄsqliteº¯Êý£¬ºÜÁ÷ÐС£
¼òµ¥Ãè ......
Ajax¿ò¼Ü jQuery
jQueryÊÇÒ»¿îÃâ·ÑÇÒ¿ª·ÅÔ´´úÂëµÄJavaScript´úÂë¿â£¬ÓÉJohn Resig´´½¨¡£ÊÚȨÐÒéΪGPLºÍMITÐí¿É֤˫ÐÒ顣ʾÀý´úÂ룺 $("p.neat").addClass("ohmy").show("slow"); ÌصãÇáÁ¿¼¶¾GZipѹËõºó´«ÊäµÄ´úÂëÎļþ½ö14KB£¬Î´¾Ñ¹Ëõ´«Ë͵ĴúÂëÎļþ½ö26KB¡£ jQuery 1.26°æʱ£º µµ°¸µµ°¸ÐÐÊýµµ°¸Size ±¸×¢ jquery-1.2 ......
AjaxµÄÔÀíºÜ¼òµ¥£¬¾ÍÊÇÔÚ¿Í»§¶Ë´´½¨Ò»¸öXMLHttpRequest¶ÔÏó£¨ÓÃÀ´Óë·þÎñÆ÷½øÐÐÒ첽ͨÐÅ£¬Õâ¾ÍÊÇAjaxµÄºËÐÄ£¬ÆäʵÎÒÃÇÔç¾ÍÔÚÓÃÒ첽ͨÐÅÁË£¬Ö»ÊÇû°ÑÕâÏî¼¼ÊõÓÃÔÚÍøÒ³Éè¼ÆÖжøÒÑ£©£¬Îª¸Ã¶ÔÏóµÄonreadystatechange ÊôÐÔÌí¼ÓÒ»¸öʼþ£¬µ±¶ÔÏóµÄreadyState¸Ä±äµÄʱºò¾Í»áÒý·¢Ö¸¶¨µÄʼþ¡£µ½´Ë¾Í¿ÉÒԾͷ¢ËÍÇëÇó¶ÁÈ¡·þÎñÆ÷¶ ......
Ê×Ïȶ¼ÊÇʹÓÃVS.Net2005´´½¨Ò»¸ö ASP.Net AJAX-Enabled Web Application
1¡¢Ê¹ÓÃAJAXÖ±½Óµ÷Óúǫ́·½·¨£º
ºǫ́´úÂ룺
namespace AJAX1
{
public partial class _Default : System.Web.UI.Page
{
// ÐèÒª±êʶΪWebMethod ......
C Sharp(C#)ÖÐÈçºÎɾ³ýÎļþ(Îļþ¼Ð)
Ö±½Óɾ³ý:
using System.IO;
...
string filePath = @"D:\...\xxx.xxx";
if (File.Exists(filePath))
{
File.Delete(filePath);
}
else
{
Console. ......