Javascript: Difference between revisions

From Server STB
Jump to navigation Jump to search
(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...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<script>
  <script>
var url = "https://raw.githubusercontent.com/iherbs/quran-json/main/";
  var url = "https://raw.githubusercontent.com/iherbs/quran-json/main/";
async function get(file = "") {
  async function get(file = "") {
   return new Promise((resolve, _reject) => {
   return new Promise((resolve, _reject) => {
     xmlhttp = new XMLHttpRequest();
     xmlhttp = new XMLHttpRequest();
Line 13: Line 13:
     xmlhttp.send();
     xmlhttp.send();
   });
   });
}
  }
 
  async function ambil(){
async function ambil(){
     var re = await get(url + "surah_list.json");
     var re = await get(url + "surah_list.json");
     document.write(re);
     document.write(re);
}
  }
ambil();
  ambil();
</script>
  </script>

Latest revision as of 01:34, 28 June 2024

 <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>