zoukankan      html  css  js  c++  java
  • ajax 增加

    一般处理程序

    <%@ WebHandler Language="C#" Class="insertdaily" %>

    using System;
    using System.Web;

    public class insertdaily : IHttpHandler {

    public void ProcessRequest (HttpContext context) {


    string has = "{"return":"false"}";
    int a = Convert.ToInt32(context.Request["classcode"]);
    string b = context.Request["TC1"];
    string c = context.Request["TC2"];
    string d = context.Request["TC3"];
    int e = Convert.ToInt32(context.Request["count"]);
    int f = Convert.ToInt32(context.Request["countS"]);





    using (HQDataContext con = new HQDataContext())
    {
    TableClass tb = new TableClass();
    tb.ClassCode = a;
    tb.Date = DateTime.Now;
    tb.TC1 = b;
    tb.TC2 = c;
    tb.TC3 = d;
    tb.TC4 ="";
    tb.CountAll = e;
    tb.CountS = f;
    con.TableClass.InsertOnSubmit(tb);
    con.SubmitChanges();

    has = "{"return":"true"}";



    }


    context.Response.Write(has);
    context.Response.End();



    }

    public bool IsReusable {
    get {
    return false;
    }
    }

    }

    $.ajax({
    url: "inserthomework.ashx",
    data: { "studentcode": code1, "taskcode": taskcode, "Scompletion": complecation, "Sremark": remark},
    type: "post",
    dataType: "json",
    success: function (msg) {
    //if (msg.return == "false")

    // alert("aa");
    //else
    // alert("bb");
    },
    error: function () {
    alert("报错");
    }
    });

  • 相关阅读:
    GL线程
    Texture,TextureRegion,Sprite,SpriteBatch
    设置壁纸
    CentOS7下安装MySQL,修改端口
    读《大道至简》有感
    课程作业01汇总整理
    读《大道至简》有感(伪代码)
    01实验性问题总结归纳
    oracle日期时间的加减法
    C# 根据年、月、周、星期获得日期等
  • 原文地址:https://www.cnblogs.com/weiyu11/p/7231452.html
Copyright © 2011-2022 走看看