Hi,
I have a container and some actions according to
<div id="container"></div>
<a href="#" class="action" id="add">Add user</a>
<a href="#" class="action" id="view">View user</a>
Notice i use a unique container to load any page. When i click an action, it triggers a click event
// dialog settings
var settings = {
add:{
buttons:{
"Add user":function() {
// some action
}
},
open:function(e, ui) {
$(this).load("/add.xhtml");
}
},
view:{
buttons:{
"View user":function() {
// some action
}
},
open:function(e, ui) {
$(this).load("/view.xhtml");
}
}
};
$(".action").click(
function(e) {
e.preventDefault();
$("#container").dialog(settings[$(this).attr("id")].dialog());
}
);