jquery form validation in ajax and non ajax way