Ajax Call Sequence in a function
<p>I have a little question. say i have a js function</p>

<pre><code>$(function() {
 $(".button").click(function(){ 
 var id=$(this).attr('id');
 var dataString = 'id='+ id ;
 $.ajax({
   type: "POST",
   url: "download_number.php",
   data: dataString,
   cache: false,
   success: function(html)
   {
     $("#div_"+id).html(html);
   }  });
   window.open('File_download.php?file_id='+id, '_blank' );
  });
</code></pre>

<p>as you can see <code>window.open</code> call is after $.ajax call</p>

<p>Does it guaratee that $.ajax call will get executed every time before the page reloads and if no then </p>

<p>shouldn't we declare <code>window.open</code> in success function? </p>

<p>In my opinion when there is slow response from server the page will reload first and it may happen that <code>$.ajax</code> call will be interrupted by <code>window.open</code> function</p>

<p>but i get a downvote for the same reason here stackoverflow.com/questions/12908138/how-to-get-the-id-or-name-of-related-file/ </p>

<p>And Thanks for making my belief stronger </p>
