I want to send the form data to server-side. I have two ways:
- Normal form submission.
or - Convert the form data to json and send to server and decode the json at server-side.
I want to know which is the best way? Is the 2nd approach is better/secure than the 1st one? if it is than why?
Both methods are equally secure, because they really are doing the same thing.
Things is , the normal form submit is mandatory. User require that functionality always. If you add the XHR
POSTto the mix, it is more of an interface feature/improvement then anything else. Under the hood it will be doing exactly the same interaction with server. The difference will be in data that you receive from server (whole page of just JSON with status details).If you are looking for better login security, then you should focus more on HTTPS stuff, or maybe try to integrate external authentication systems, like OpenID.