I have this code, so in javascript there should be a return true and return false, but in this statement there is only one false return, the return true is implicit?
if (_form.find ('# name'). val () === '') { _form.find ('# name'). addClass ('u-validate'); return false; };
this is the original function
$("#btn-registrar").on('click', function(event) {
event.preventDefault();
var _form = $("#form-add-marcas");
if (_form.find('#name').val()==='') {
_form.find('#name').addClass('u-validate');
return false;
};
if (_form.find('#description').val()==='') {
_form.find('#description').addClass('u-validate');
return false;
};
$.ajax({
url: baseURL +'marcas/action_add',
type: 'POST',
dataType: 'json',
data: _form.serializeArray(),
})
.done(function(response) {
if (Boolean(response.status)===true) {
loadURL(baseURL+'marcas/list_marcas');
//alert(response.message);
}else{
alert(response.message);
_form.find('#'+response.id).addClass('u-validate');
}
})
.fail(function(response) {
console.log("error",response);
})
});