I know js validation is for client side and php validation is for server side. User can skip the js validation and submit but is it possible when I am getting the action php file in ajax?
I mean I am using the following code to validate the form. as you see I am calling postProjectAction.php in the ajax.. If an user skip the JS/disable the js and submit the form, form won't be submitted because,
- my form has no action
- the form data will not be inserted or submitted to the database if the postProjectAction.php is not called. when user disable the js the code won't call the postProjectAction.php
so there is no chance to submit the form. Is this still insecure?
html:
<form id="form_validation" method="POST">
</form>
js validation:
$(document).ready(function() {
$("#form_validation").submit(function() {
if ($("#form_validation").valid()) {
var data1 = $('#form_validation').serialize();
$.ajax({
type: "POST",
url: "postProjectAction.php",
data: data1,
success: function(msg) {
console.log(msg);
$('.messagebox').hide();
$('#alert-message').html(msg);
$('.messagebox').slideDown('slow');
}
});
}
return false;
});
});