I have the following code :
Ok Using implementation case 1 is to use ajax and display error or success on the opened dialog :
So , i have added the following ajax code on above code section ...
"Attach Comment": function() {
//do form posting here
$.ajax({
context: $(this),
url:"${resource()}"+"/issue/attachComment",
type:"POST",
data:{"comment":$('#commentArea').val(),"id":$("#selectedIssueInstanceId").val()},
success:function(data){
if(data.success)
{
var tobeAppendeID = $("#selectedIssueInstanceId").val();
$('#'+'comment_'+tobeAppendeID).val(data.newComment);
$( this ).dialog( "close" );
}
else
{
$('#error-message').addClass('ui-state-error ui-corner-all');
$("#error-message").html(data.message).show()
$(this).dialog("close");
}
$( this ).dialog( "close" );
}