zoukankan      html  css  js  c++  java
  • PartialView+$.reload()局部刷新

    $('input.pass').mouseup(function () {
                    alert($(this).parents('form').serialize());
                    $(this).parents('div.custom-card').load('@Url.Action("CheckPartial", "Agent")', $(this).parents('form').serialize());
                    $(this).prevAll('span').removeClass();
                    $(this).prevAll('span').addClass('status-1');
                });
    [HttpGet]
            public ActionResult CheckPartial()
            {
                Session["Id"] = 1;
                var UserID = Convert.ToInt32(Session["Id"]);
    
                using (HoldenZhongbaoEntities _context = new HoldenZhongbaoEntities())
                {
                    //var checkObject = JsonConvert.DeserializeObject(checkJson);
                    var checkOrderID = Request.QueryString["OrderID"];
    
                    var order = _context
                    .Cashes
                    .Where(u => u.OrderID == checkOrderID)
                    .FirstOrDefault();
    
                    order.IsAdminCheck = Convert.ToInt32(Request.QueryString["IsAdminCheck"]);
                    order.AdminCheckTime = DateTime.Now;
                    order.Note = Request.QueryString["Note"];
    
                    _context.SaveChanges();
    
                    return PartialView("CheckPartial", order);
                }
            }

    1.$.serialize()是直接在Url后面加参数
    2.刷新的范围是
    div.custom-card这个div块里面的内容
    3.注意PartialView里面的JS不要少,刷新出来的PartialView只能读取到自己的JS,读不到整个页面的JS
    4.$.html()只能刷新纯HTML,不能带CSS和JS
  • 相关阅读:
    [SCOI2003]严格N元树
    CF280 C. Game on Tree
    [HDU2281]Square Number
    [HDU5391]Zball in Tina Town
    [HDU3988]Harry Potter and the Hide Story
    [HDU5794]A Simple Chess
    [HDU5451]Best Solver
    [HDU1724]Ellipse
    [HDU6304]Chiaki Sequence Revisited
    [HDU6343]Graph Theory Homework
  • 原文地址:https://www.cnblogs.com/Jayesslee/p/9253949.html
Copyright © 2011-2022 走看看