Hi,
I have a hashmap that I have created to control the events for buttons. It is defined as so:
var Signage_Manager = {
init: function() {
Signage_Manager.buttonActions.set_events();
},
buttonActions: {
buttons: {
'#add_product': {action: 'navigate', href: '/manager/add_product'},
'.back_to_dashboard': {action: 'navigate', href: '/manager/dashboard'}
},
set_events: function() {
for(var button in Signage_Manager.buttonActions.buttons){
if(Signage_Manager.buttonActions.buttons[button].action == 'navigate') {
$(button).live('click', function() {
console.log(Signage_Manager.buttonActions.buttons[button].href);
});
}
else {
$(button).live('click', function() {
//
console.log('not navigate');
});
}
}
}
}
};
The problem is when I click the 'add_product' button, it tries to use the href '/manager/dashboard', instead of the '/manager/add_product' string that is in the defined row.
Can anyone offer a hand here?