I'm no expert, but you could try the following;
function print () {
var row = $ ('# dg'). datagrid ('getSelected');
$.post('impress.php?&cCodalu =' + row.codalub,{id:'dummy'},function(result){
if (result.success){
...success processing...
} else {
...failed processing...
}
},'json');
}