title: Push values into array jquery
body: <p>I have created an empty array at the beginning of the form</p>
  
  <pre><code>&lt;script&gt;
     var monthly_values = [];
     var i=0;
  &lt;/script&gt;
  </code></pre>
  
  <p>Inside the loop trying to achieve below code....
  but the push doesn't work without "alert" box nor if i remove "ready(function())"</p>
  
  <pre><code>$prodline=500$    /// CGI script loops till 500 iterations 
  &lt;script&gt;
   $(document).ready(function(){
       i++;
       monthly_values.push("$premium$");
       setTimeout(function() { 
         alert("$premium$");
       }, 1);
  
   });
  &lt;/script&gt;
   $/prodline$//end of the iteration...
  </code></pre>
  
  <p>I push values from loop into array which is working .But i need to remove alert box or at least OK from alert box .. </p>
  
  <p>The Entire Code is here..</p>
  
  <pre><code>    &lt;html&gt;
      &lt;head&gt;
        &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"&gt;&lt;/script&gt;
         &lt;title&gt;PHP FILE  - $licensee$&lt;/title&gt;
         &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;   
         &lt;meta name="Author" content="COMPULIFE Software, Inc."&gt;
         &lt;link href="../../css/styles_website.css" type="text/css" rel="stylesheet"&gt;
         &lt;link href="../../css/termsampler.css" type="text/css" rel="stylesheet"&gt;
         &lt;link href="../../css/$css$" type="text/css" rel="stylesheet"&gt; 
      &lt;script&gt;
           var monthly_values = [];
           var i=0;
      &lt;/script&gt;
  
      &lt;script language="JavaScript" type="text/javascript"&gt;
        //     var monthly_values = [];
           // var i=0;
      function getbest (ambest, company, compcode)
      {
        document.comparisonform.AmBest.value = ambest;
        document.comparisonform.CompanyName.value = company;
        document.comparisonform.CompanyCode.value = compcode;
        document.comparisonform.OnClick=abc=window.open('','reason','width=700,height=500,left=20,top=20,scrollbars=yes');
        document.comparisonform.target='reason';
        abc.focus();
        document.comparisonform.submit();
      }
      &lt;/script&gt;  
      &lt;/head&gt;
      &lt;body&gt;
      &lt;/tr&gt;
      &lt;style&gt;
      .loader {
        border: 16px solid #f3f3f3;
        border-radius: 50%;
        border-top: 16px solid #3498db;
        width: 120px;
        height: 120px;
        -webkit-animation: spin 2s linear infinite;
        animation: spin 2s linear infinite;
        margin: auto;
        padding: 10px;
      }
  
      @-webkit-keyframes spin {
        0% { -webkit-transform: rotate(0deg); }
        100% { -webkit-transform: rotate(360deg); }
      }
  
      @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
      }
      &lt;/style&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;div class="loader" style &gt;&lt;/div&gt;
      $prodline=500$
  
      &lt;script&gt;
        $(document).ready(function(){
          i++;
          monthly_values.push("$premium$");
          setTimeout(function() { 
            alert("$premium$"+"$company$"+"$product$"+"$healthcat$"+"$PremiumAnnual$"+"$Premium$"+"$rgpfpp$"+"$guar$"+"$policyfee$"+"$comp$"+"$prod$"+"$rowEvenOdd$");
          }, 1);
  
        });
      &lt;/script&gt;
      $/prodline$
      &lt;/table&gt;
  
      &lt;/form&gt;
  
      &lt;br&gt;&lt;br&gt;
  
      &lt;script&gt;
        $(document).ready(function(){
  
          var len=monthly_values.length;
          var min_quote=monthly_values [0];
            var max_quote=monthly_values [monthly_values.length-1];
  
          window.location = 'http://loalhost/laravel/public/customised-quote?min_quote_val='+min_quote+'&amp;max_quote_val='+max_quote;
        });
      &lt;/script&gt;
  </code></pre>