Submit form via ajax to server and check if there were any errors | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Submit form via ajax to server and check if there were any errors

Any experienced full stack web developer here? I need some help regarding validating a form via javascript and then submitting it on server. What i am trying to do is validate a form via javascript, if form is validated, i send this form to server via ajax. If server sends any error, i call a javascript function to display that error message. This didn't work for me and on top of that someone informed me that this isn't a safe way to do it. I asked a question on stackoverflow (https://stackoverflow.com/questions/50348267/check-if-form-has-been-submitted-via-ajax-in-php) but i haven't gotten a solution yet. Can someone please guide me on this. Please refer to link to my question on stackoverflow for more context. Question is HOW CAN I achieve what i am trying to do and in a secure way ?

15th May 2018, 11:38 AM
Yousaf
Yousaf - avatar
2 Answers
15th May 2018, 11:41 AM
Amethyst Animion
Amethyst Animion - avatar
0
i don't know how this can help me as it is hard for me to understand this code. Can you please explain a bit in context to my problem
15th May 2018, 11:47 AM
Yousaf
Yousaf - avatar