简体   繁体   中英

How to session variable using jquery and PHP

In my code i want to assign value of jquery variable to PHP variable and session that PHP variable and use it in another page.For session i am using jquery plugin jquery.session.js.But i am getting error like TypeError: cookies[i].split is not a function .

  $(function() {
     var certificate_id =123;
    $.session.set("myVar", certificate_id);
      alert($.session.get("myVar"));
    });

Please help me in solving this.

Please provide more information, where does this error occur? Where do you use the cookies[i].split function?

Additionally, you can't manipulate a PHP session variable directly using the jQuery session variable. Instead, you need to do this with a combination of AJAX and a PHP script. Please refer to Setting a PHP $_SESSION['var'] using jQuery

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM