views:

211

answers:

2

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?

+2  A: 

Call back methods are your friend here:

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

That will make the second submit happen after the first.

Peter
This won't work unless the first form is submitted through Ajax. If you do a normal submit, the browser will submit the data and a new page is loaded and the callback function is lost.
SolutionYogi
+3  A: 

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:

Jonathan Sampson
I want that server side as i said in my Question
Amr ElGarhy