ajax - Manually sending a post in PHP
663
I have a form that will be validated client side before being submitted via an ajax request to the server for server-side validation. Should the validation fail server side then a postback will need to be made containing all the error messages. Is there some way I can do this?
For example:
UPDATE
Answer
Here is the javascript that handles the submission of the form:
And here is the php function that the ajax posts to:
Answer
Solution:
Your answer will be in two parts:
Pseudo code:
Part1: PHP
Part2 AJAX: modify you ajax response to this.
Answer
Solution:
Use json ajax request. In case error exists show the error message. I generally put a flag for success or fail .