Solved

Help with jscript syntax for writing simple cookie

Posted on 2009-07-15
3
435 Views
Last Modified: 2012-05-07
After consulting several recommended tutorials on cookies, I came up with the following line for putting the value of the variable shipWeight into a simple cookie, for debugging purposes.

document.cookie = "shipWeightCookie="+shipWeight;

Unfortunately, it "breaks" the code.  The function runs OK (although without the desired result) when this line is commented out.

Could someone tell me what is wrong with this syntax?
The examples in tutorials generally assume you want to write an explicit string value to the cookie rather than the value of a variable.
0
Comment
Question by:netsmithcentral
  • 3
3 Comments
 
LVL 12

Author Comment

by:netsmithcentral
ID: 24865385
I suspect the problem may be

<script language="JScript" type="text/jscript" runat="server">

just above the function.

The function must run server side.  Does this preclude writing a cookie?

How else can I get variable data out of the function for debugging purposes?
I could find no information on writing session variables directly out of jscript.  Most say can't be done because it runs client side.
However, this function explicitly runs server side.
0
 
LVL 12

Accepted Solution

by:
netsmithcentral earned 0 total points
ID: 24897117
Once I determined that the function would return a number, if I replaced the designed return value with that number,
I was able to debug the jscript "runat server" script by replacing the designed Return value of the function with different variable values from within the function.

This is the kind of thing that is obvious after it is pointed out.
0
 
LVL 12

Author Comment

by:netsmithcentral
ID: 24897132
Question should have been reframed as query about debugging techniques to use with jscript runat server function.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Google Analytics 4 130
DIV Panel Jumps to side when jQuery Sticky kicks in 2 374
nvd3.js license 3 816
how to avoid duplicate value selection in drop down 18 1,401
There are many Password Managers (PM) out there to choose from. PM's can help with your password habits and routines, but they should not be a crutch you rely on too heavily. I also have an article for company/enterprise PM's.
Note: This is the third blog post in a series on email clearinghouses (https://www.xmatters.com/alert-management/blog-email-has-failed-us?utm_campaign=70138000000ydLoAAI&utm_source=exex&utm_medium=article&utm_content=blog-post).   We’ve been talki…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now