I have a javascript/jQuery setup where a page name is given. A function should then take this, get the html
data of the page and alert it.
HTML
var page = $(this).attr('id');
viewPage(page);
function viewPage(page) {
var html = pages.page;
alert(html);
}
var pages = {
page1: 'Content of page.....',
[etc...]
}
However, the variable html
is always returning as undefined. When I manually access the page from the pages
array it works fine. What's the issue?
Thanks in advance!