; //btnTestGet按钮监听的绑定 var clickRouter=new jsEvent.EventRouter(iobj,"onclick"); clickRouter.addListener(btnTestGetClick); } function btnTestGetClick() { // open参数 url, onload, params, method, contentType, onerror cobj = new net.xmlHttp("DefaultHandler.ashx?T=1",dealResult, null, "GET"); } /**//* Get end*/
function dealResult() { var dobj = document.getElementById("divResult"); dobj.innerHTML = cobj.req.responseXML.text; }
window.onload = function() { //绑定Post发送xmlHttp事件到btnTestPost loadTestPost(); //绑定Get发送xmlHttp事件到btnTestGet loadTestGet(); };
最后是.net处理xmlHttp的代码 .net 处理xmlHttp请求 public class DefaultHandler : IHttpHandler { protected XmlDocument _xmlResult;
public void ProcessRequest(HttpContext context) { if (context.Request["T"] != null) {//GET xmlhttp测试 context.Response.ContentType = "text/xml"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(string.Format(@"<time> 上一页 [1] [2] [3] [4] [5] [6] 下一页 |