title: How to automatically hit download URL and download a file using javascript?
body: <p>In WordPress there's a feature that exports your data into xml files. You can hit this URL with parameters and it will start downloading XML file. The <em>cat</em> parameter indicates the ID of the category containing posts you want to include in the XML file.</p>
  
  <p>The problem is that I have over 200 categories and I want to export every category into separate file. So have to hit this url 
  <a href="http://www.domain.com/wp-admin/export.php?download=true&amp;content=posts&amp;cat=" rel="nofollow">http://www.domain.com/wp-admin/export.php?download=true&amp;content=posts&amp;cat=</a>" + [category_num] + "&amp;post_author=0&amp;post_start_date=0&amp;post_end_date=0&amp;post_status=0</p>
  
  <p>in FOR loop or something like this</p>
  
  <pre><code>for (i=1; i &lt;= 200; i++) { 
  hit ("http://localhost/lyricsgroove/wp-admin/export.php?download=true&amp;content=posts&amp;cat="+i+"&amp;post_author=0&amp;post_start_date=0&amp;post_end_date=0&amp;post_ status=0");   
  }
  </code></pre>
  
  <p>You can try hitting your WP website /wp-admin/export.php?download=true&amp;content=posts&amp;cat=1&amp;post_author=0&amp;post_start_date=0&amp;post_end_date=0&amp;post_ status=0 and you'll see XML downloading.</p>
  
  <p>I need to do the same but in loop.</p>
  
  <p>I tried doing this in PHP using file_get_contents and in jQuery using $.ajax but none of them starts download.</p>