Я использую плагин cookie jQuery (также пробовал с EZCookie), я застрял с этой ошибкой в Firefox:
'$.cookie is not a function'
at line:
if(!( $.cookie('name') == null) ) {
Я получаю другую ошибку JavaScript в IE 6
"Object doesn't support this property or method"
Странная вещь, когда я комментировал $(document).ready(function() {
,
Я не получаю никакой ошибки, но тогда я также не вижу cookie (даже после установки cookie из другого приложения).
У кого-нибудь есть подсказка, что здесь происходит ...
Вот код, который я использую:
<script type="text/javascript">
var var2= "";
$(document).ready(function() {
if($.cookie('name').length > 0) {
alert("cookie present"+$.cookie('name'));
<%
String[] var1= (String[]) componentRequest.getComponentSession().getValue("var");
if(!(null == offices)){
for(int i = 0; i < var1.length; i++){%>
var2+=<%=var1[i]%>+",";
<%}
}%>
$('#tempCookieVal').val(var2+$.cookie('name'));
$('#cookieForm').submit();
}else{
alert("no cookie");
$('#tempCookieVal').val("NoCookie");
$('#cookieForm').submit();
}
alert("cookie check done");
});
</script>
<form id="cookieForm" >
<input name="tempCookie" type="hidden" id="tempCookieVal" />
</form>