JavaScript Global Variables
<pre><code>var channelsArray = [];
var percentArray= [];
var valueArray= [];
var jsonData,canvas,context;
var colorArray=["#ECD078","#D95B43","#C02942","#542437","#53777A"];
var posX=220;
var posY=60;
var width=55;
var graph=false;


//Webservice Request and Response begins....................................... 

        $.ajax({
            type: "POST",
            url: "http://localhost/WebSite1/myservice.asmx/GetData",
            dataType: "json",
           contentType: "application/json; charset=utf-8", 
            success: function(msg) {
        if(localStorage.getItem("channels")==null){
                  jsonData =jQuery.parseJSON(msg.d);
                  jsonToLocal();        
             }     
                 var strDisplay = " &lt;table cellspacing='0' id='myTable' " +
                                 " &lt;tr&gt;" +
                                 " &lt;th &gt; Channels &lt;/th&gt;" +
                                 " &lt;th&gt; Percentage&lt;/th&gt;" +
                                 " &lt;th&gt; Value&lt;/th&gt;" +
                                 " &lt;/tr&gt;";
                for (var i = 0; i &lt; colorArray.length; i++) {
                    strDisplay = strDisplay +
                                 " &lt;tr style='cursor:pointer;' onclick='javascript:rotateChart("+i+")'&gt;" +
                                 " &lt;td&gt;" + channelsArray[i] + "&lt;/a&gt; &lt;/td&gt;" +
                                 " &lt;td&gt; " + percentArray[i] + " &lt;/td&gt;" +
                                 " &lt;td&gt; " + valueArray[i] + " &lt;/td&gt;" +

                                 " &lt;/tr&gt;";

                }
                strDisplay = strDisplay + "&lt;/table&gt;";

                document.getElementById('DynamicGridLoading').innerHTML = strDisplay;
                  document.getElementById('myTable').setAttribute("class","datatable");


            },


             error:function(xhr, ajaxOptions, thrownError){
             alert(xhr.statusText);
            }
        });

//Webservice Request and Response ends........................

//converting json data into local storage....

function jsonToLocal(){




            for(i=0;i&lt;jsonData.Table.length;i++){

               percentArray.push(jsonData.Table[i].toString());
               channelsArray.push(jsonData.Table[i].Channels);
               valueArray.push(jsonData.Table[i].Value);
            }


            try {
                    localStorage.setItem("percentage", percentArray.join(",")); 
                    localStorage.setItem("channels",channelsArray .join(","));
                    localStorage.setItem("value",valueArray.join(","));



                }
            catch (e) {
                            if (e == QUOTA_EXCEEDED_ERR) {
                                 alert("Quota exceeded!");
                             }
                      }

}
</code></pre>

<p>this is my almost entire code...am getting this 'uncaught' error in function jsontolocal at percentArray....if i remove this line..other two work fine.. all these arrays are pushing string values inside dem..</p>
