Solved

Help with jscript syntax for writing simple cookie

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Always backup Domain, SYSVOL etc.using processes according to Microsoft Best Practices. This is meant as a disaster recovery process for small environments that did not implement backup processes and did not run a secondary domain controller that ne…
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

762 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