Category: cakePHP

Clear form fields after finishing ajax submit using Jquery

Use reset() method to clear form fields after submitting the form via ajax. $.ajax({ type:"POST", url:formUrl, data:formData, beforeSend:function(){ $(‘.status’).html(‘<b>Form is being submitted</b>’); }, success:function(data){ $(‘. status ‘).html(‘<b>Thank you!! We have received your form</b>’); }, complete:function(){ $(‘#form-id’).each(function(){ this.reset(); //Here form fields will be cleared. }); }});

Read More…