Guys, I’m having a trouble with a cookie.
The error:
“linhaOS” isn’t defined.
I wanna know if the cookie is null in the beggining of code.
$("#pApresentacao").click(function _click(){
if ($.cookie("exibir") == null)
{
if ($("#hdLinhaOsView").val() != ""){i=$("#hdLinhaOsView").val()}
else {i=0};
$.cookie("exibir",1);
$.cookie("linhaOS",i);
_apresentacao(i);
}
else
{
if ($.cookie("linhaOS") == null){i=0}
else{i=$.cookie(linhaOS)};
_apresentacao(i);
};
The first cookie(exibir) is working fine. But the second is not! How is it possible? It is almost the same.
Could someone help me?
Thks folks.
Your problem isn’t
$.cookie(...)it’s that the variablelinhaOSis not defined.So how to fix it? Well I suppose you wanted to use
$.cookie("linhaOS")once again, and you just forgot to quote it as a string with"". So just quote it as a string, that will fix your problem.