1

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.

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

3 Comments

In my code i have added jquery.session.js plugin.In that TypeError: cookies[i].split is not a function error occurs.
I have refered that link but in that any one can see data response using web browser extension.
What is the use case you want to cover? You want to transfer data from the client to the server, this data can be monitored by the user. However, cookies and javascript variables could also be observed by users. I don't exactly understand what you want to achieve.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.