[英]Why this JQuery Cookie value dosen't update?
I just want to set the cookie as 'es' if it's undefined. 我只想将cookie设置为“ es”(如果未定义)。 But, this code dosen't work. 但是,此代码无效。
//UELS: GLOBALS
//Set 3 globals vars
//Where you are
var masterPage = $('meta[name=description]').attr("content");
//Which language you are using
//If undefined [new cookie]:
//Set ES as default language
if ($.cookie('lang') == undefined){
$.cookie("lang", "es");
}
alert($.cookie('lang'));
var masterLang = $.cookie('lang')+"_";
//Languages' usher
var callCenter = {};
//Caller var
var current_lang = masterLang+masterPage;
The alert should show 'es' but the cookie never changes. 警报应显示“ es”,但cookie永不更改。 I put an alert in the condition and it showed, so the if statement works fine. 我在条件中放置了一个警报,它显示出来,因此if语句可以正常工作。
Any idea? 任何想法?
I was running the web from XAMPP and it dosen't work fine. 我从XAMPP运行网络,但效果不佳。 I try it out there and works perfectly. 我在那里尝试并完美运行。 Didn't know why. 不知道为什么。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.