html+ashx 表单提交
来源:互联网 发布:阿尔法宝贝复制软件 编辑:程序博客网 时间:2024/05/16 18:40
1,sumbit表单提交
WebForm1.aspx源码:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="NETFormDemo.ashx.WebForm1" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head ><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <script type="text/javascript"> </script></head><body> <form id="form1" action="submitForm.ashx" > <div> <input type="submit" value="提交" /> </div> </form></body></html>
submitForm.ashx源码:
using System;using System.Collections.Generic;using System.Linq;using System.Web;namespace NETFormDemo.ashx{ /// <summary> /// submitForm 的摘要说明 /// </summary> public class submitForm : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write("Hello World"); } public bool IsReusable { get { return false; } } }}
2,ajax提交
HtmlPage1.html 源码:
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="test1.js" type="text/javascript"></script> <script src="jquery-1.4.min.js" type="text/javascript"></script> <script type="text/javascript"> function add(url) { var A = $("#a1").val(); var B = $("#b1").val(); $.ajax({ url: "ashx/add.ashx?i=" + A + "&j=" + B, data: { num1: A, num2: B }, dataType: "html", success: function (result) { } }); } </script></head><body> <form id="form1" runat="server"> <input type="text" id="a1" /> <input type="text" id="b1"/> <input type="button" onclick="add()"/> <label id="lb"></label> </form> </body> </html>add.ashx源码:
using System;using System.Collections.Generic;using System.Linq;using System.Web;namespace NETFormDemo.ashx{ /// <summary> /// Login 的摘要说明 /// </summary> public class Login : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int first = Convert.ToInt32(context.Request.Params["i"]); int sec = Convert.ToInt32(context.Request.Params["j"]); int res = first + sec; context.Response.Write(res); context.Response.Write("fdd ff"); } public bool IsReusable { get { return false; } } }}
0 0
- html+ashx 表单提交
- 【.Net码农】html+ashx 表单提交示例
- html:表单和表单提交
- HTML表单提交规则
- HTML 提交表单 效验
- html表单提交事件
- html表单提交
- html - form提交表单
- HTML表单的提交
- HTML表单提交
- html表单提交分析
- [HTML] 表单提交与阻止表单提交
- [HTML] 表单提交与阻止表单提交
- HTML表单的提交方式
- html表单图片按钮提交
- html input image提交表单
- html form表单提交处理
- html表单提交数据验证
- ubuntu使用root账户
- hdu 1429胜利大逃亡(续) / sdut 2193 救基友记3(BFS)
- FreeMarker由浅入深之一 FreeMarker简单介绍
- Java程序员分类
- Tomcat工作原理详解
- html+ashx 表单提交
- 解决vi编辑器不能使用方向键和退格键
- ssh mysql win7 linux编码怪谈
- 【C/C++】C++预处理指令介绍
- FreeMarker 由浅入深二 FreeMarker开发环境搭建
- 关于mysql error.log报"Using unique option prefix myisam-recover instead of myisam-recover-options ..."
- PS常用的快捷键
- 下载spring jar 地址
- 网易邮箱,那些你知道和不知道的事呢?