用JQUERY在ASP.NET环境(C#)实现最基本的AJAX
来源:互联网 发布:淘宝中差评处理话术 编辑:程序博客网 时间:2024/05/17 20:26
页面文件:<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ajaxtext._Default" %> ajax.ashx:using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Services;using System.Threading;namespace ajaxtext{ /// /// $codebehindclassname$ 的摘要说明 /// [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class ajax : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string uname = string.Empty; string passwd = string.Empty; uname = context.Request["u"].ToString(); passwd = context.Request["p"].ToString(); Thread.Sleep(1000); if (uname == "gen.li" && passwd == "123456") { context.Response.Write("success"); } else context.Response.Write("fail"); } public bool IsReusable { get { return false; } } }}JS: function ajax_test() { var uname = document.getElementById("username").value; var passwd = document.getElementById("passwd").value; $.ajax({ type: "POST", url: "ajax.ashx", data: "u=" + uname + "&p=" + passwd, beforeSend: function() { $("#result").text("数据处理中..."); }, success: function(msg) { if (msg == "success") { $("#result").text("验证通过!"); } else { $("#result").text("验证失败,密码或者用户名错误!"); } } }); }
- 用JQUERY在ASP.NET环境(C#)实现最基本的AJAX
- jquery 实现asp.net 的ajax
- ASP.NET+JQuery实现AJAX的分页
- 在Asp.net中使用jquery实现Ajax
- 在Asp.net中使用jquery实现Ajax
- 在Asp.net中使用jquery实现Ajax
- 在Asp.net中使用jquery实现Ajax (转)
- 关于jQuery在Asp.Net Mvc 框架下Ajax文件上传的实现
- AJAX在ASP.NET中的应用(二)——Jquery封装的AJAX
- Ajax在asp.net上的基本应用
- Ajax在asp.net上的基本应用
- 另一种ASP.NET与Ajax 的实现方式--jQuery
- jQuery + ASP.NET MVC Ajax的简单实现
- 另一种ASP.NET与Ajax 的实现方式--jQuery
- asp.net+jquery+xml实现最简单的聊天室
- asp.net ajax实现(—):Jquery+Json
- asp.net jQuery ajax 实现登陆
- WCF AJAX在asp.net上的初级实现DEMO
- 简单让Flash藏到Div浮动层下面?
- 嵌入式linux启动信息完全注释
- 学会调整自己的情绪
- windows下判断txt的编码方式
- SQL Server 2005 CLR 调用Web Service需要注意的几个问题
- 用JQUERY在ASP.NET环境(C#)实现最基本的AJAX
- “IHTMLDocument2Ptr”: 未声明的标识符
- 3年,一定要坚持下来!
- 浅析permission标签的区别及用法
- 基本数据类型的长度
- WordPress: Akismet in BlogEngine.NET
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARAM,LPARAM)”
- 过半手机程序出卖用户私隐
- see mips run 读书笔记(待写)