zoukankan      html  css  js  c++  java
  • ajax-C#

     $(document).ready(function(){
        $("#month").change(function () {
            var yearSelect = $("#year").find("option:selected").val();
            var monthSelect = $("#month").find("option:selected").val();
            var jsonFormat = "{year:" + yearSelect + ",month:" + monthSelect + "}";
            $.ajaxWebService("GetInfo", jsonFormat, function (data) {
            });
        });
        });
    
        $.ajaxWebService = function (url, dataparam, datasuccess) {
            $.ajax({
                type: "POST",
                dataType: "json",
                contentType: "application/json",
                url: url,
                data: dataparam,
                success: datasuccess,
                error: function (a, b, c) { }
            });
        }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    
    namespace NXT.Areas.Anm.Controllers
    {
        public class MonthlyReportController : Controller
        {
            //
            // GET: /Anm/MonthlyReport/
    
            public ActionResult Index()
            {
                string year = Request["year"];
                string month = Request["month"];
                return View();
            }
    
            [HttpPost]
            public JsonResult GetInfo(string year,string month)
            {
                //***
                var data = new
                {
                    id = 1,
                    text = "sdfsdfsdfsdf"
                };
                return Json(data, JsonRequestBehavior.AllowGet);
            }
        }
    }
  • 相关阅读:
    简单理解同步与异步
    Python3.x 安装Scrapy框架
    Python命名规范
    python 02/100例
    raw_input与input的区别
    二叉排序树
    串和广义表
    数据结构整理 第一章
    时间复杂度
    Music
  • 原文地址:https://www.cnblogs.com/hellowzd/p/4468354.html
Copyright © 2011-2022 走看看