So I pull from a database a list of items and then display the titles as a list
global.screens.menu.search = function() {
var searchData = document.getElementById('search-input').value;
global.method.request('search-item', {title: searchData}, function(err, res) {// if() error handling logic}
// show new list of items.
else {
var list = document.createElement('ul');
for (var i = 0; i < res.list.length; i++) {
var item = document.createElement('li');
item.setAttribute('id', 'search-list-' + res.list[i].id);
item.appendChild(document.createTextNode(res.list[i].title));
list.appendChild(item);
}
document.getElementById('list').appendChild(list);
}
})
};
this created a list of items that look like
<li id="search-list-12">the first book</li>
<li id="search-list-16">the fourth book</li>
What I'm trying to do is make each of these items clickable (hyperlink) to a new page called product-page.html and pass the book ID so that I can display the book in the product page by the ID.
I was thinking of just setting session variable to the book ID then setting an href to "localhost://product-page" and on the redirect page load populate the page then delete the session variable. Not sure if that's the right approach.
in my product-page.html I have a function call that will populate everything. I just need to pass it an ID for the item.
global.screens.product.activate(id); //