Solved

Help with jscript syntax for writing simple cookie

Posted on 2009-07-15
3
440 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Populate input box in php page based on drop down selection 2 644
Add days to a date 3 211
how to move the Y-scale inside a chart with "echarts" 2 112
Problem with jscript mask. 3 107
This tutorial shows how to create a greeting card by combining two image layers and a text layer on a PC using a free image editing app.
This article outlines why you need to choose a backup solution that protects your entire environment – including your VMware ESXi and Microsoft Hyper-V virtualization hosts – not just your virtual machines.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

803 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