使用mvc测试Demo
================view================
@{ ViewBag.Title = "Index"; Layout = null;}ajax请求参数测试
===============controller===============
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;using System.Web.Script.Serialization;namespace ContentReplace.Controllers{ public class AjaxRequestController : Controller { // // GET: /AjaxRequest/ public ActionResult Index() { return View(); } public JsonResult GetTestAjax(TestClass test) { var data = ""; return Json(data, JsonRequestBehavior.AllowGet); } public JsonResult GetTestAjax2() { var json = Request["json"]; var jss = new JavaScriptSerializer(); var arr = jss.Deserialize(json); var data = ""; return Json(data, JsonRequestBehavior.AllowGet); } [HttpPost] public JsonResult GetTestAjax3(TestClass test,List list) { var data = ""; return Json(data, JsonRequestBehavior.AllowGet); } [HttpPost] public JsonResult GetTestAjax4(TestClass test) { var data = ""; return Json(data, JsonRequestBehavior.AllowGet); } } public class TestClass { public int ID { get; set; } public string Name { get; set; } public DateTime Date { get; set; } public List ListStr { get; set; } } }