Amr Elgarhy
Amr Elgarhy

Reputation: 68952

How to make a page wait till another page finish submit?

I am using Javascript-JQuery to submit 2 aspx pages,

$('#MyForm1').submit();

$('#MyForm2').submit();

for some reason i want form1 to don't start loading or submitting until form1 finish loading.

I want all of this to be server side.

Can a page wait another page in asp.net?

Upvotes: 0

Views: 795

Answers (2)

Sampson
Sampson

Reputation: 268364

Updated Answer...

I want that server side as i said in my Question

– Amr ElGarhy

jQuery is not ran or accessible from the server. Your server cannot control your client-side scripts, not directly at least. I am not sure what you mean by "wanting this server-side." What you can do is send off a request to your server with the first submission (of form1), and when the response is being constructed on the server, add rules to tell the client-side script what to do with the second form.

Beyond that, you aren't being entirely clear.

Original Answer...

You'll have to send the data from form1 asynchronously, and then within the callback (assuming success) submit form2.

Read More: jQuery AJAX

Stackoverflow Archive:

Upvotes: 3

Peter
Peter

Reputation: 421

Call back methods are your friend here:

$('#MyForm1').submit(function() {
   $('#MyForm2').submit();
});

That will make the second submit happen after the first.

Upvotes: 2

Related Questions