AJAX请求和RoR中的CookieOverflow

时间:2022-01-26 07:06:21

I'm making a dynamic checklist and I'm having some problems with AJAX requests and database updating. Basically when an item is clicked, I asynchronously update the database to say that an item has been clicked. Here is the javascript :

我正在做一个动态检查表,在AJAX请求和数据库更新方面有一些问题。基本上,当单击某个项时,我异步更新数据库,以表示已经单击了一个项目。这里是javascript:

    $('.checkBoxContainer').click( function() {
    $(this).css("background-color", "#FFF3D8");
    $(this).find("input").attr("disabled", "disabled")
    $(this).find("p").css("text-decoration", "line-through")
                     .css("color", "#AAA");
    $.ajax({
        type : "POST",
        url : "updateDone",
        data : "id=" + $(this).attr("id") 
    });
});

Here is the method in the controller

这是控制器中的方法

def updateDone
    currentItem = Item.find(params[:id])
    currentItem.update_attribute(:done => true)
  end

The following code works for only 5 items or so before the command prompt shoots me a "Cookie Overflow" error. I'm not using any cookie or session data so how is this producing this error? If it turns out to be a cookie problem (though I don't see how) how would I clear the session/cookie data in the server/browser so the client can make more than 5 items on the checklist?

下面的代码只适用于大约5个项目,然后命令提示符向我发送一个“Cookie溢出”错误。我没有使用任何cookie或会话数据那么它是如何产生这个错误的呢?如果结果是一个cookie问题(尽管我不知道如何解决),我该如何清除服务器/浏览器中的会话/cookie数据,以便客户端能够在检查表中创建5个以上的项?

1 个解决方案

#1


3  

Either store less stuff in the session, or move the session store to memcache.
The default cookie based session store can only hold upto ~ 4kb of data, because cookies as per standard are not allowed to have a bigger size.

要么在会话中存储较少的内容,要么将会话存储移动到memcache。默认的基于cookie的会话存储只能保存大约4kb的数据,因为按照标准的cookie不能有更大的大小。

#1


3  

Either store less stuff in the session, or move the session store to memcache.
The default cookie based session store can only hold upto ~ 4kb of data, because cookies as per standard are not allowed to have a bigger size.

要么在会话中存储较少的内容,要么将会话存储移动到memcache。默认的基于cookie的会话存储只能保存大约4kb的数据,因为按照标准的cookie不能有更大的大小。