Javascript

From Server STB
Revision as of 01:32, 28 June 2024 by Admin (talk | contribs) (Created page with "<script> var url = "https://raw.githubusercontent.com/iherbs/quran-json/main/"; async function get(file = "") { return new Promise((resolve, _reject) => { xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", file); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { // console.log(xmlhttp.responseText); resolve(xmlhttp.responseText); } }; xmlhttp.send(); }); } async functio...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<script> var url = "https://raw.githubusercontent.com/iherbs/quran-json/main/"; async function get(file = "") {

 return new Promise((resolve, _reject) => {
   xmlhttp = new XMLHttpRequest();
   xmlhttp.open("GET", file);
   xmlhttp.onreadystatechange = function () {
     if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
       // console.log(xmlhttp.responseText);
       resolve(xmlhttp.responseText);
     }
   };
   xmlhttp.send();
 });

}

async function ambil(){

   var re = await get(url + "surah_list.json");
   document.write(re);

} ambil(); </script>