ASP.NET-后台cookie与前台JQUERY解析cookie

在controller中给cookie赋值
    
    
    
    
  1. HttpCookie cookie = new HttpCookie("pageInfo");
  2. cookie["page_index"] = page_index.ToString();
  3. cookie["page_count"] = page_count.ToString();
  4. Response.AppendCookie(cookie);

前端用getCookie来操作cookie
    
    
    
    
  1. $("#ui_input_btn02").click(function () {
  2. var page_data = getCookie("pageInfo").toString();
  3. page_index = String(page_data).substr(11, 1);
  4. var new_page = Number(page_index) - 1;
  5. $.post("/Order/Page", { data: new_page }, function (data) {
  6. var page_data = getCookie("pageInfo").toString();
  7. page_index = String(page_data).substr(11, 1);
  8. $("#page_now").text(page_index);
  9. $("#test").html(data);



来自为知笔记(Wiz)


你可能感兴趣的:(ASP.NET-后台cookie与前台JQUERY解析cookie)