Home  >  Article  >  Web Front-end  >  Can the local cookies set by jQuery be accessed by other pages? _html/css_WEB-ITnose

Can the local cookies set by jQuery be accessed by other pages? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:43:321335browse

A small thing made using html and jquery needs to realize data sharing between pages


Reply to the discussion (solution)

Set the path path It's okay to be/is. But it must be a cookie under the same domain name

All pages under the scope can be accessed
http://www.cnblogs.com/chenqianpeng/archive/2012/04/24/2468642. html

uses html, a small thing made by jquery, and needs to realize data sharing between pages



if($('#materialId').val()! =0){
var materialId = $('#materialId').val();
$.cookie("A",AK[materialId][0],{path:'/'}); //Put the value of A into cookie
$.cookie("K",AK[materialId][1],{path:'/'});
alert($.cookie("A")) ;
//alert();
The value prompted is undefined I don’t know what went wrong I didn’t use the server at all
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn