Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <p id="p1"></p>
- <select>
- <option >a</option>
- <option >b</option>
- <option >c</option>
- <option >d</option>
- </select>
- <button id="btn">CALCOLA</button>
- <script>
- function funzione() {
- let ris = 0;
- for (let i=0; i<1000000000; i++){
- ris += Math.sqrt(i*Math.sin(i)*Math.sin(i));
- }
- return ris;
- }
- async function funzione_fetch() {
- const risposta_server = await fetch("https://www.camuso.it/test/elabora_con_ritardo.php");
- //alert("attesa terminata!");
- const dati = await risposta_server.text();
- document.getElementById("p1").innerText=dati;
- }
- //document.getElementById("btn").addEventListener("click", funzione_fetch);
- funzione_fetch();
- alert("sono ritornato subito dalla funzione async anche se non terminata");
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement