jquery ajax post ashx
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jquery ajax post ashx相关的知识,希望对你有一定的参考价值。
var data = {ClId:ClId,Title: Title,Subhead: Subhead,BeginTime: BeginTime,
EndTime:EndTime ,TelecastType:TelecastType,Teacherkey: Teacherkey ,AssistantTeacherKey: AssistantTeacherKey ,
StudentClientKey: StudentClientKey ,StudentWebKey:StudentWebKey ,
TelecastDateContent:TelecastDateContent ,TelecastDescription: TelecastDescription ,
TeacherId: TeacherId ,Status: Status ,ImgUrl: ImgUrl ,SDKID:SDKID ,
DelayModel:DelayModel }
$.ajax({
type: "POST",
url: "/Manage/usercenter/data/TelecastLessionInfo.ashx?action=update",
//url: "/Manage/usercenter/zhibo/update/save",
//contentType: "application/json",
//dataType: "json",
data: data,
success: function (result) {
alert("修改直播课堂成功!");
window.location.href = "/Manage/usercenter/zhibo/index";
},
error: function () {
alert("修改直播课堂失败!");
}
});
public void ProcessRequest(HttpContext context) { string FilePath = System.Web.HttpContext.Current.Server.MapPath("~/") + "/log/zhibo/log_" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt"; WebTools.FileOper.FileStream fs = new WebTools.FileOper.FileStream(FilePath); context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; HttpResponse response = context.Response; try { string action = string.Empty; if (request.QueryString["action"] == null) { response.Write("无法获取到action参数!"); fs.WriteFile("LuoBo-" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "无法获取到KeTangSDKID参数!" + Environment.NewLine, Encoding.UTF8, true); return; } action = request.QueryString["action"].ToString(); string strResult = string.Empty; switch (action) { case "single": if (request.QueryString["ClId"] == null) { response.Write("无法获取到ClId参数!"); fs.WriteFile("LuoBo-" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "无法获取到ClId参数!" + Environment.NewLine, Encoding.UTF8, true); return; } int nClId = Convert.ToInt32(request.QueryString["ClId"]); strResult = GetSingleTelecastLessionInfo(nClId);break; case "list": strResult = GetTelecastLessionInfoList(); break; case "update": // { // ClId: ClId,Title: Title,Subhead: Subhead,BeginTime: BeginTime, //EndTime: EndTime ,TelecastType: TelecastType,Teacherkey: Teacherkey ,AssistantTeacherKey: AssistantTeacherKey , //StudentClientKey: StudentClientKey ,StudentWebKey: StudentWebKey , //TelecastDateContent: TelecastDateContent ,TelecastDescription: TelecastDescription , //TeacherId: TeacherId ,Status: Status ,ImgUrl: ImgUrl ,SDKID: SDKID , //DelayModel: DelayModel } string strClId = request["ClId"];
以上是关于jquery ajax post ashx的主要内容,如果未能解决你的问题,请参考以下文章