One button should redirect either to page AAA or to page BBB. This decision should depend on the choice of the buttons on the page before.
Page 1: #home
In addition to @ezanker's answer, you can retrieve all details related to the clicked button as well as previous and next pages on pagebeforechange
event.
$(document).on("pagebeforechange", function (event, data)
Those details can be obtained from data object. For example, clicked / linked button details are retrieved from data.options.link
object. previous page data.options.fromPage
, and next page data.toPage
.
This event fires twice on transition, for the current page and the page it's moving to.
$(document).on("pagebeforechange", function (e, data) {
/* when webpage is first initialized, .link and .toPage are undefined */
if (data.options.link && data.toPage) {
if (data.toPage[0].id == "setpage") {
var button = data.options.link[0].text;
/* for demo */
$("#setpage [data-role=content]").html("Clicked button: " + button);
}
}
});
Demo