Why doesn't jQuery getJSON function execute when a page is redirected instead of called directly?
<p>I have a JSP page which calls several <code>jQuery.getJSON()</code> functions subsequently. I render some charts and all works very well. The user clicks on a menu item (URL) to invoke this JSP page.</p>

<p>The getJSON functions and processing scripts execute within   <code>$(document).ready(function()...</code></p>

<p>However when the user is redirected to the same page after logging in, the functions won't execute. I think I must be missing something fundamental with regard to Ajax or jQuery, but I cannot find an answer after several hours of trawling the web.</p>

<p>Here's the JSP file:</p>

<pre><code>&lt;%@ taglib uri="/tags/struts-bean" prefix="bean" %&gt;
&lt;%@ taglib uri="/tags/struts-html" prefix="html" %&gt;
&lt;%@ taglib uri="/tags/struts-logic" prefix="logic" %&gt;
&lt;%@ page import="org.apache.struts.Globals" %&gt;
    &lt;%
    /*
    * Dashboard Main Page
    *
    * Version History:
    *
    * Initial version.      
    *
    */
    %&gt;      

&lt;html:html locale="true"&gt;

&lt;%@include file="/pages/include_skillsauction_header.html"%&gt;

&lt;body&gt;

&lt;head&gt;
    &lt;script language="javascript" type="text/javascript"&gt;

      function changeDivHTML()
      {
        document.getElementById('chart-container-1').innerHTML = "&lt;img src='/apvbase/img/ajax-loader.gif'/&gt;";
      }   
    &lt;/script&gt;

&lt;script type="text/javascript" src="../../js/jquery.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="../../js/highcharts.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="../../js/themes/grid.js"&gt;&lt;/script&gt;

&lt;script&gt;
$(document).ready(function()
{  
 $(function() 
 { 

 // ---
   $.getJSON('../../JScriptUtils.do?method=getProjectRisks', function(arr)
   {
      chartRisks = new Highcharts.Chart({
         chart: {
            renderTo: 'chart-container-1',
            defaultSeriesType: 'column',
            borderWidth: 2
      },
    title: {
            text: 'Project Risk Profile'
      },
    subtitle: {
         text: 'All Open Risks by Project'
      },
    tooltip: {
         formatter: function() {
            return ''+
               this.x +': '+ this.y +' logins';
         }
      },
    xAxis:
    {
        categories: arr.name,
        labels: {
                rotation: -45,
                align: 'right',
                style: {
                    font: 'normal 8px Verdana, sans-serif'
            }
    }},       
    yAxis: {
                min: 0,
                max: 50,
                title: {
                    text: 'Risks'
                 },
                tickInterval: 10
            },
      series: [
      { data: arr.data,
          dataLabels: {
                enabled: true,
                formatter: function() {
                 return this.y;
                }
            },
        name: 'Risks Raised'
     }
         ]
      });
   });

 // +++
 }); // function()
}); // ready()

&lt;/script&gt;  
&lt;/head&gt;
&lt;div id="document"&gt;

  &lt;%@include file="/pages/include_recruiter_header.jsp"%&gt;

 &lt;div id="main"&gt;

  &lt;div id="content-section"&gt;
      &lt;div id="contentsNoSideBar"&gt;
        &lt;!-- Display Login details --&gt;

        &lt;h2&gt;&lt;bean:message key="recruiter.provFeedback.heading"/&gt;&lt;/h2&gt;           
    &lt;p&gt;
    &lt;table&gt;
     &lt;/tr&gt;
      &lt;td&gt;
        &lt;div id="chart-container-1" style="width: 34%; height: 300px"&gt;&lt;/div&gt;
      &lt;/td&gt;
     &lt;/tr&gt;
    &lt;/table&gt;
      &lt;/div&gt;
  &lt;/div&gt;
 &lt;/div&gt;
 &lt;div id="siteInfo"&gt; 
      &lt;%@include file="/pages/include_standard_footer.jsp"%&gt;
 &lt;/div&gt;
&lt;/div&gt; 

&lt;script&gt;
 // Display the spinner icon until ready ..
    changeDivHTML();
&lt;/script&gt;
&lt;/body&gt;

&lt;/html:html&gt;
</code></pre>

<p>Any help is greatly appreciated.</p>
