Can I validate only with jQuery or do I need PHP?

forms, javascript, jquery, php, validation

Solution

you should do both of these validations - jQuery for user friendly response to what the user is missing or entered wrong - asap feedback from the client side.

you can't trust the client, so you always have to do server-side data checks to make sure everything is correctly entered.

It is best to pass the data over and check it again on the server-side then complete your action (email, database inserts, outputs)

Problem

I understand the difference between the two languages, but when it comes to form validation. Is jQuery enough? Can I validate my form in jQuery/JavaScript and then do an AJAX call to send the completed form to an email address? Is it even possible to send form data to an email address using JavaScript? Or is it somewhat safer to do everything in PHP? I ask this because using PHP is what I'm used to, however, I've recently started working with more advanced JavaScript and jQuery.

Original source