I have a rails 2.1 application have the following code:
class CookieController < ApplicationController
def index
extra = cookies["extra"]
end
end
<%= "index" %>
<script type="text/javascript">
set_cookie();
display_cookie();
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split('';'');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)=='' '') c =
c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return
c.substring(nameEQ.length,c.length);
}
return null;
}
function createCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" :
";expires="+exdate.toGMTString());
}
function set_cookie()
{
createCookie("extra","testbbb",100);
createCookie("another","testanother",100);
createCookie("ptheme","ccc",100);
}
function display_cookie()
{
alert(document.cookie)
var x = readCookie(''ptheme'')
}
</script>
The problem is that I can not see the cookie in controller when using
ie, I can not see the cookie when use firefox.
Any suggestion?
Thanks in advance
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---