AlertDialogBox with callback function

When on click event of button "++" fired, the "increase_CB" function, is called.

NB: in parameters, the name of callback function is given without brackets. Callback function is optionnal.

Source Code


$(document).ready(function() {
	//To use advanced settings, you must define var.
	var msg = new AntMessageBox();			
		
	var nb_callback = 0;
	//the callback function
	function increase_CB() { 
		nb_callback++;
	}
		
	$("#open").click(function () {
		//Variables of AntMessageBox
		var content = "<article style='width: 650px'><div>Click to increase the number below...</div>"
		content += "<div>nb callbacks  = "+nb_callback+"</div></article>";
		var title ="Try callback function";
		var target_element_id = "#zone"; //you can use all selector's of jQuery to select target of content of MsgDialogBox					
		var label="++";
		
		//Message box initialized				
		msg.initDialogBox(title, target_element_id, content);
		msg.AlertDialogBox(null, increase_CB, label);
	});
});