0

I have this code:

<input type="submit" onclick="window.location='https://www.example.com/script.php';" value="CLICK HERE" id='dwl_btn_load'>

When I press on CLICK HERE the page start to load and run https://www.example.com/script.php.

The script (https://www.example.com/script.php) automatically downloads me a file and takes about 20 seconds while the page is loading.

I want to make this procces without page load if is posible.

I have only 1 input without tag.

Thank you.

brombeer
  • 6,294
  • 4
  • 18
  • 26
Toony
  • 11
  • 3
  • possibly duplicate question of https://stackoverflow.com/questions/1066452/easiest-way-to-open-a-download-window-without-navigating-away-from-the-page – WebSwami May 21 '19 at 11:12

1 Answers1

0

Try this using jQuery AJAX Call

<script>
$(document).ready(function(){
$.ajax({ url: "https://www.example.com/script.php",
        context: document.body,
        success: function(){
           alert("done");
        }});
});
</script>
Mariano
  • 167
  • 10
  • This example loads the page for 20 seconds until the script is loaded. It's not what I'm looking for – Toony May 21 '19 at 10:41
  • there are something take more time, so you need to check functions into "script.php", paste content of this PHP Page – Mariano May 21 '19 at 10:45
  • I want to load the whole story of script.php without loading page ... like with ajax – Toony May 21 '19 at 10:51