之前写的Ajax 本来没有问题,过久了不写老是报错
程序这个东西 一点点不对就报错
有的是收不到值
有的是 格式不对
前端代码
@{
ViewBag.Title = “Index”;
}
后端代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace test.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
return View();
}
public JsonResult getsum(string id)
{
try
{
// string iid = Request.Params["id"];
int idd = int.Parse(id);
int xxx = idd + 10000;
return Json(xxx, JsonRequestBehavior.AllowGet);
}
catch {
var xx = "操作失败";
return Json(xx, JsonRequestBehavior.AllowGet);
}
}
}
}