HTML:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
chat.ashx:
<%@ WebHandler language= "C #" class= "Chat"%> using System;
Using System.Web;
Using System.Xml; public class Chat:ihttphandler {public void ProcessRequest (HttpContext context) {context.
Response.ContentType = "Text/plain"; String strcontent = context. Request.querystring["C"].
ToString (); String Strfromid = context. Request.querystring["F"].
ToString (); String Strsendid = context. Request.querystring["S"].
ToString ();
int intsuccess = 0;
String strdate = DateTime.Now.ToString ("HH:mm:ss");
XmlDocument xmldoc = new XmlDocument (); try {xmldoc.load (context).
Server.MapPath ("Chat.xml"));
XmlNode root = Xmldoc.selectsinglenode ("chat");
XmlElement xmle = xmldoc.createelement ("message");
Xmle.setattribute ("FId", Strfromid);
Xmle.setattribute ("SId", Strsendid);
XmlElement xmled = xmldoc.createelement ("datetime");
Xmled.innertext = strdate;
Xmle.appendchild (xmled);
XmlElement Xmlec = xmldoc.createelement ("content");
Xmlec.innertext = strcontent;
Xmle.appendchild (Xmlec); Root. AppendChild (XMLE); Xmldoc.save (context.
Server.MapPath ("Chat.xml"));
intsuccess = 1; The catch (Exception ex) {throw ex;} context.
Response.Write (intsuccess); public bool IsReusable {get {return false;}}}
The above is a small set for you to introduce the use of jquery invoke XML to realize no refresh instant chat, I hope to help you, if you have any questions welcome to my message Oh!