Note that there are some explanatory texts on larger screens.

plurals
  1. POStoring data in JavaScript array
    primarykey
    data
    text
    <p>This is my jsp code where I am trying to push some data in javaScript array. </p> <pre><code> &lt;% int proListSize = proList.size(); ProfileDAO proDAO = null; for(int i = 0, j=1; i &lt; proListSize; i++){ proDAO = (ProfileDAO)proList.get(i);%&gt; entireArray.push(&lt;%= proDAO.getNetworkmapId()%&gt; + ":"+&lt;%=proDAO.getAssetId()%&gt; + ":" + &lt;%= proDAO.getCode()%&gt;); &lt;%} %&gt; </code></pre> <p>And this is the function where I am trying to use it by using pop function.</p> <pre><code>function GenDemographicTag() { var ptag = "&lt;!-- Begin "+networkNameToUpperCase+" --&gt;\n" ; var t = ""; if (WhiteTagLabelDomain) { ptag += "&lt;iframe src=\"http://"+WhiteTagLabelDomainTrim+"/jsc/"+folderName+"/dm.html?"; } else { ptag += "&lt;iframe src=\"http://"+cdnName+"/jsc/"+folderName+"/dm.html?"; } ptag += "n="+networkId+";"; for(var i = 0;i&lt; entireArray.length;i++){ var combinedString = entireArray.splice(1,1); var rightSide = combinedString.split(':')[0]; var middle = combinedString.split(':')[1]; var leftSide = combinedString.split(':')[2]; t = ""; if ( $("proElementEnable_"+rightSide) &amp;&amp; $("proElementEnable_"+leftSide).checked) { if ( middle == "1") { if ( $("zip").value.length &lt;= 0) { t = "0"; } else { t = $("zip").value; } } else if ( $("targetList_"+rightSide) &amp;&amp; $("targetList_"+rightSide).length &gt; 0 &amp;&amp; $("targetList_"+rightSide).options[0].value != "-1") { t = makeProelementList($("targetList_"+rightSide)); } ptag += leftSide+"=" + t+ ";"; } proDAO = null; } ptag += "\" frameborder=0 marginheight=0 marginwidth=0 scrolling=\"no\" allowTransparency=\"true\" width=1 height=1&gt;\n&lt;/iframe&gt;\n&lt;!-- end "+networkNameToUpperCase+" --&gt;\n"; document.forms[0].tag.value = ptag; } </code></pre> <p>Basically I am trying to get the data from proList and store it in javaScript array(entireArray)...so that I can use in the javascript function..but after doing the above I get a javaScript error as follow:</p> <pre><code>entireArray.push(3 + ":"+3 + ":" + d3); entireArray.push(185 + ":"+5 + ":" + d4); entireArray.push(2 + ":"+2 + ":" + d2); entireArray.push(186 + ":"+5 + ":" + d9); entireArray.push(183 + ":"+5 + ":" + d6); entireArray.push(184 + ":"+5 + ":" + d7); entireArray.push(187 + ":"+5 + ":" + da); entireArray.push(445 + ":"+5 + ":" + db); Reference Error:d3 is not defined. </code></pre> <p>what is the exact problem..? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload