jQuery在页面之间传递数据

use*_*936 6 jquery

我是jQuery的新手.有没有办法booked通过jQuery 检索另一个页面的值?

$(document).ready(function() {
    $(".active").click(function() {
        var booked=$(this).val();
        confirm(booked);
    });
});
Run Code Online (Sandbox Code Playgroud)

Rob*_*ben 6

如果纯粹在客户端使用cookie或HTML5 localStorage.

localStorage.setItem('bookedStatus' + customerId, true);
Run Code Online (Sandbox Code Playgroud)

如果数据已经提交给服务器,则使用ajax.

$.get('/site/getBookingStatus?customerId=' + customerId, function(data){
   alert(data);
});
Run Code Online (Sandbox Code Playgroud)