How to do a Jquery Callback after form submit

0 votes

I have a simple form with remote=true.

This form is actually on an HTML Dialog, which gets closed as soon as the Submit button is clicked.

Now I need to make some changes on the main HTML page after the form gets submitted successfully.

I tried this using jQuery. But this doesn't ensure that the tasks get performed after some form of response of the form submission.

$("#myform").submit(function(event) {

// do the task here ..

});

How do I attach a callback, so that my code gets executed only after the form is successfully submitted? Is there any way to add some .success or .complete callback to the form?

Jul 24, 2020 in Angular by kartik
• 37,520 points
8,427 views

1 answer to this question.

0 votes

Hello @kartik,

Just do like this -

 $("#myform").bind('ajax:complete', function() {

         // tasks to do 


   });

Hope it works!!

Thank You!!

answered Jul 24, 2020 by Niroj
• 82,840 points

Related Questions In Angular

0 votes
1 answer

How to send multipart/form-data for a file upload in Angular?

In Angular, you can send files using ...READ MORE

answered Feb 24 in Angular by Navya
158 views
0 votes
1 answer

How to implement a directive that adds tooltips to form controls dynamically?

Custom Tooltip Directive 1. Create the Directive import { ...READ MORE

answered Apr 10 in Angular by anonymous
40 views
0 votes
1 answer

How to develop a directive that modifies element styles based on form validation status?

Here's a concise directive that automatically applies ...READ MORE

answered Apr 10 in Angular by anonymous
46 views
0 votes
1 answer

How can we reload a page after requesting the same get parameter using AngularJS?

hey kartik, The reason for this is that ...READ MORE

answered Feb 10, 2020 in Angular by Niroj
• 82,840 points
12,811 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
23,574 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
3,186 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
3,250 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
45,877 views
0 votes
1 answer

How do you bind an Enum to a DropDownList control in ASP.NET?

Hello @kartik, I probably wouldn't bind the data as it's ...READ MORE

answered Jul 23, 2020 in Angular by Niroj
• 82,840 points
3,149 views
0 votes
1 answer

How to know tools and bundlers after create a new workspace or a project in angular?

Hello @sajal, When you create projects and workspaces ...READ MORE

answered Aug 6, 2020 in Angular by Niroj
• 82,840 points
1,208 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP