function sendData()
{
var ret = {'result' : true};
commentForm.find('button').hide().next().show();
sendDataComment.docid = commentForm.find("#login").val();
$.post(
"savecomment.php",
sendDataComment,
function(data){
if(data)
{
data = $.parseJSON(data);
var errors ='';
$.each(data, function(i, val) {
errors += val+'\n';
});
if(errors)
ret['result'] = false;
//return ("textarea").addClass('error-data');
commentForm.find('button').show().next().hide();
//alert(errors);
}
else
formToComment();
}
)
return ret['result'];
}
if(! sendData()){
/* ошибки в каких то полях */
}