You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Handling Cookie values in Custom Script by Javascript

Received Response
14
Views
1
Comments
edited Dec 14, 2016 5:14PM in UI Extensibility 1 comment

Content

Hi,

In the Contact workspace, We have added a tab to implement a feature where we are using custom script.

We want to pass some vales from one script to another by cookie. 
Cookie setting is OK. We are getting the value from the cookie.

$_COOKIE["course_name"] = $student_course_details["course_name"];    
    echo "Cokievalue".$_COOKIE["course_name"];

But when we tried to access the value from javascript, it is giving me null.

Here is my javascript code:

<script> 
    var cokie_value = getCookie('CourseName');
    alert(cokie_value);
 
     function getCookie(name) {
      var regexp = new RegExp("(?:^" + name + "|;\s*"+ name + ")=(.*?)(?:;|$)", "g");
      var result = regexp.exec(document.cookie);

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!