Ajax基础
来源:互联网 发布:selfie city照相软件 编辑:程序博客网 时间:2024/06/05 21:02
Ajax本质是浏览器端的多线程
一、简单的用js实现Ajax
前段
<script type="text/javascript"> window.onload = function () { document.getElementById('btnGetTime').onclick = function () { //1.向服务器请求 时间 var xhr = new XMLHttpRequest(); xhr.open("get", "C02GetTime.ashx?Name='zj'", true); xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { var res = xhr.responseText; alert(res); } }; xhr.send(null); } } </script>后台
using System;using System.Collections.Generic;using System.Linq;using System.Web;namespace Ajax{ /// <summary> /// C02GetTime 的摘要说明 /// </summary> public class C02GetTime : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write(DateTime.Now.ToString()); } public bool IsReusable { get { return false; } } }}
0 0
- Ajax 基础
- Ajax基础
- Ajax基础
- AJAX基础
- AJAX基础
- ajax基础
- ajax基础
- Ajax 基础
- ajax基础
- AJAX基础
- AJAX 基础
- Ajax基础
- Ajax基础
- AJAX 基础
- ajax基础
- AJAX基础
- Ajax基础
- Ajax基础
- Ogre导入3Dmax模型注意事项
- 使用qtcreator时出现The specified source space "/home/xxx/src" does not exist的错误
- 高并发下的 Nginx 优化方案
- Android字体Typeface设置
- 1058. A+B in Hogwarts (20)
- Ajax基础
- JDBC中Date类型数据的插入
- iOS 设计模式
- 对vc6.0平台运行Debug的程序出现:应用程序无法正常启动(0xc0150002).请单击“确定”关闭应用程序
- Flare-On Challenge1 Writeup
- 详解EBS接口开发之WIP模块接口
- 【JavaScript 学习】没啥参考价值,纯记录,来自w3school
- 笔试题
- ZOJ-1130