$(document).ready(function() { 

var options = { 
 				url: "/cer_ugc/feedback.do",
				dataType: 'text',
        beforeSubmit:  showRequest,  // pre-submit callback 
        success:       showResponse  // post-submit callback 
    }; 
 
    // bind to the form's submit event 
    $('#feedback_form').submit(function() {         
        $(this).ajaxSubmit(options); 
        return false; 
    }); 
	
	
});

// pre-submit callback 
function showRequest(formData, jqForm, options) {     
    var queryString = $.param(formData); 
    //alert(queryString); 
    var formElement = jqForm[0];    
    if(formElement.body.value == ""){
    	alert("Comment is required to submit")
    	return false;
    }     
    return true; 
} 
 
// post-submit callback 
function showResponse(responseText, statusText, xhr, $form)  {     
		if(statusText == "success"){			
			alert("Your comment has been received. We will review your comment and post it if it complies with our comment policy.");
		}  
} 
