zoukankan      html  css  js  c++  java
  • AJAX一般处理程序

     1 <script type="text/javascript">
     2 function Tpfb(wzfbID) {
     3 $.messager.confirm("系统提示""您确定要发布吗?", function (r) {
     4 if (r) {
     5 $.ajax({
     6 cache:false,
     7 type: "GET",
     8 url: 'TP_WZFB.ashx?HandlerType=WZFB&FBWZID=' + wzfbID + '&TITLE=' + 
     9 
    10 $("#txtTitle").val(),
    11 dataType: 'json',
    12 success: function(data)
    13 {
    14 if (data.State == "1")
    15 {
    16 $.messager.alert("系统提示""发布成功!");
    17 parent.location.href = parent.location.href;
    18 }
    19 else
    20 $.messager.alert("系统提示", data.Message, "error");
    21 }
    22 });
    23 }
    24 });
    25 }
    26 </script>
    27 
    28  
    29 
    30 2、.ashx(一般处理程序文件)的参数接收和处理方法:
    31 
    32 //接收
    33 
    34 public override void OnRequest(HttpContext context)
    35 {
    36 context.Response.ContentType = "text/plain";
    37 string strContext = "";
    38 string HandlerType = context.Request["HandlerType"];
    39 switch (HandlerType)
    40 {
    41 case "WZFB":
    42 strContext = Tpfb(context);
    43 break;
    44 default:
    45 break;
    46 }
    47 context.Response.Write(strContext);
    48 }
    49 
    50 //处理方法
    51 
    52 private string Tpfb(HttpContext context)
    53 {
    54 //投票信息ID
    55 string fbwzID = context.Request["FBWZID"];
    56 
    57 return Hzjg.GlobalExpand.ToJson(oMes);//结果要返回JSON格式字符串,与前台调用
    58 
    59 AJAX保持一致
    60 
    61 }
  • 相关阅读:
    《Spring_Four》第二次作业 基于Jsoup的大学生考试信息展示系统开题报告
    《Spring_Four》第一次作业:团队亮相
    4.11jsp
    4.7jsp
    3.17jsp
    3.24jsp
    3.10jsp
    3.4软件测试
    回文串
    博客园第二次作业
  • 原文地址:https://www.cnblogs.com/zecVip/p/4429171.html
Copyright © 2011-2022 走看看