Implementation of jquery form validation using php with mysql database
I write a small chunk of code a form which is below.
In above code, form tag has two selectors like id, action both are required for the form processing. Action are required on which you form being processed. ID is required for pick values suppose if multiple forms then it will more helpful. Another is “Submit” button with their click event we fire a request & process it. After processing it will return JSON format response on the basis of that we can manipulate the DOM elements. So we require a function when we click on the submit button it will perform required function. Now below I write a code.
In above code “server_validation” its function for which need to pass the certain parameter on the basis of that it perform form processing. The parameter explanation is below
form_id:’add_form’ // its the Id of form
button_id:’add_button’, // its the Id button
after_success:load_success // its the name of function that call after success of form.
With the help of above code you can just validate form but if you want any callback function then call below function
In the above code, every thing is same only I added the “after_success” variable in which I pass the name of the function that needs to call after the success of form.