Is it good (I mean security reasons) to pass the database request (select or update or something else) on the server side as a parameter (for example, I read the values ββof the form fields, formed a query string in javascript and passed the generated string for the server as a parameter):
$.ajax({ url : "servletURL", type : "post", data: {query: "select name, last_name from employees"}, success: //do things });
or
var name = document.getElementById('name').value; var last_name = document.getElementById('last_name').value; $.ajax({ url : "servletURL", type : "post", data: {query: "select * from employees where name="+name+" and last_name="+last_name}, success:
Or do I need to transfer only parameters to the server, not full requests, and make a prepared statement there?
And, of course, I can check the correctness of the field values ββbefore sending the request to the server.
source share