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
If this is a single page app, you could just switch the HREF of the setpage button when clicking the A and B buttons on the home page.
Here is a DEMO
$(document).on("pageinit", "#Home", function(){
$('.btnAB').on("click", function(e){
var id = $(this).prop("id");
if (id === 'btnB'){
$('#btnSetpage').prop('href', '#BBB');
} else {
$('#btnSetpage').prop('href', '#AAA');
}
});
});
The script above handles the click event of the 2 buttons (they have the same class). It sees which button was clicked and then sets the href of the one button on the setpage.
setpage
AAA
I am AAA
Home
BBB
I am BBB
Home