[jQuery] Trying to understand how to use global variables...

[jQuery] Trying to understand how to use global variables...

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>I’ve read up on the subject, but my application is
showing that<o:p></o:p>
<p class=MsoNormal>my understanding has gaps.<o:p></o:p>
<p class=MsoNormal><o:p> </o:p>
<p class=MsoNormal>If I have an ajax function that in the returned “response”
exists<o:p></o:p>
<p class=MsoNormal>a value called “response.STORY_ID” and I used
the statement in the<o:p></o:p>
<p class=MsoNormal>success section of the ajax function, gNewStoryID =
response.STORY_ID,<o:p></o:p>
<p class=MsoNormal>and then alert(gNewStoryID), I do get the property ID
returned in the alert.<o:p></o:p>
<p class=MsoNormal><o:p> </o:p>
<p class=MsoNormal>Now I want to use that variable, gNewStoryID, in other
functions.  My understanding<o:p></o:p>
<p class=MsoNormal>was that, by using gNewStoryID = response.STORY_ID, I was
creating a global variable<o:p></o:p>
<p class=MsoNormal>that could then be used in any function.<o:p></o:p>
<p class=MsoNormal><o:p> </o:p>
<p class=MsoNormal>However, when I try to use the gNewStoryID in another
function, for instance,<o:p></o:p>
<p class=MsoNormal>$(‘#newStoryIDSpan’).empty().append(gNewStoryID);<o:p></o:p>
<p class=MsoNormal>I get an error stating “gNewstoryID is not defined”.<o:p></o:p>
<p class=MsoNormal><o:p> </o:p>
<p class=MsoNormal>Where is my understanding in complete?  I was think
that a global javascript variable<o:p></o:p>
<p class=MsoNormal>would be available through the application as is a
ColdFusion session variable.<o:p></o:p>
<p class=MsoNormal><o:p> </o:p>
<p class=MsoNormal>Thanks for helping me understand!<o:p></o:p>
<p class=MsoNormal><o:p> </o:p>
<p class=MsoNormal>Rick<o:p></o:p>
<p class=MsoNormal><i><span style='color:#A6A6A6'>---------------------------------------------------------------------------------------------------------------------------------------<o:p></o:p></span></i>
<p class=MsoNormal><i><span style='color:#A6A6A6'>"It has been my
experience that most bad government is the result of too much government."
- Thomas Jefferson<o:p></o:p></span></i>
<p class=MsoNormal><o:p> </o:p>
</div>
</body>
</html>