fetch.html 355 B

123456789101112131415
  1. <html>
  2. <body>
  3. <script>
  4. window.ajax = async (url, options) => {
  5. const response = await fetch(url, options);
  6. const data = await response.text();
  7. const headers = {};
  8. for (const [key, value] of response.headers.entries()) {
  9. headers[key] = value;
  10. }
  11. return {data, status: response.status, headers};
  12. }
  13. </script>
  14. </body>
  15. </html>