Solved

Help with jscript syntax for writing simple cookie

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Moving applications to the cloud or switching services to cloud-based ones, is a stressful job.  Here's how you can make it easier.
In this article, I show you step by step with screenshots to assist you - HOW TO: Deploy and Install the VMware vCenter Server Appliance 6.5 (VCSA 6.5), with some helpful tips along the way.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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