you can use php (or another backend language) to build up the myArray variable before the page load. this can become problematic if there are large amounts of text you need to store. alternatively you need to perform an ajax request. to learn about ajax requests follow this tutorial -
http://www.talkphp.com/vbarticles.php?do=article&articleid=58&title=simple-ajax-with-jquery