Passing an array in a hyperlink
Instead of making the songidarray global, use a closure.

$(window).load(function () { // for example, or wherever you get the data
    var songidarray = [1,2,3,4,5,9];
    // var songidarray = [];

    var $button = $("&lt;button id='addEntireFolderButton' type='button'&gt;")
        .html("Add Entire Folder")
        .prop("disabled", songidarray.length == 0)
        .click(function () {
            applib.addentirefolder(songidarray);
        });
    $('#folderpagebackbutton').append($button);
});


The click callback above will maintain a live reference to songidarray and will pass it to the addentirefolder function when triggered. The contents of the array stay out of the HTML.

And since this is Code Review:

The type attribute on &lt;a&gt; elements is a hint for the MIME type of the referenced resource. Use the class attribute if you need to tag an element for styling.  On a &lt;button&gt;  element, type="button" makes it do nothing by default as opposed to submitting or resetting any containing form.