主要将代码粘贴,通过阅读代码理解其中的相关逻辑。
html代码:
姓名:
内容:
js代码:
" + uCont + "
插件代码:
using System; using System.Web;
public class doSave : IHttpHandler {
public void ProcessRequest(HttpContext context) {
var dic = new System.Collections.Generic.Dictionary<string,object>(); //存储的集合 string jsonStr = "{}"; //新建字符串jsonStr
context.Response.ContentType = "text/json"; //定义返回的内容类型为json
string uname = context.Request.QueryString[0]; //获取请求参数中第一个参数,也可以直接使用uname
string commet = context.Request.QueryString[1]; //定义字符串uname、commet为context请求查询的字符串context.Request.Params["username"];QyertStrubg:查询字符串
dic.Add("username",uname); //将字符串添加到对象中
dic.Add("content",commet);
jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dic); //序列化集合为json字符串
context.Response.Write(jsonStr); }
public bool IsReusable { get { return false; } }
}
此处效果即为,在输入框中输入相关文字,点击提交,下方会自动将书写的文字进行展示,无需跳转其他页面。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。
js代码:
" + uName + ":
" + uCont + "
插件代码:
using System;
using System.Web;
public class doSave : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
var dic = new System.Collections.Generic.Dictionary<string,object>(); //存储的集合
string jsonStr = "{}"; //新建字符串jsonStr
context.Response.ContentType = "text/json"; //定义返回的内容类型为json
string uname = context.Request.QueryString[0]; //获取请求参数中第一个参数,也可以直接使用uname
string commet = context.Request.QueryString[1]; //定义字符串uname、commet为context请求查询的字符串context.Request.Params["username"];QyertStrubg:查询字符串
dic.Add("username",uname); //将字符串添加到对象中
dic.Add("content",commet);
jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dic); //序列化集合为json字符串
context.Response.Write(jsonStr);
}
public bool IsReusable
{
get
{
return false;
}
}
}
此处效果即为,在输入框中输入相关文字,点击提交,下方会自动将书写的文字进行展示,无需跳转其他页面。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。