Line 4: Line 4:
 
Fetchs the quran data surah by surah. This will pull complete surah for specified surah number
 
Fetchs the quran data surah by surah. This will pull complete surah for specified surah number
  
'''Url:''' [http://api.globalquran.com/surah/getSurah/quranID http://api.globalquran.com/surah/getSurah/quranID]
+
'''Url:''' [http://api.globalquran.com/surah/getSurah/quranID http://api.globalquran.com/surah/getSurah/quranID?key=api_key]
  
 
{| border="1" cellspacing="1" cellpadding="1" style="width: 500px;"
 
{| border="1" cellspacing="1" cellpadding="1" style="width: 500px;"
Line 19: Line 19:
 
| quran id
 
| quran id
 
| list of quran id seperated by '''|''' (pipe)
 
| list of quran id seperated by '''|''' (pipe)
 +
|-
 +
| key
 +
| api key
 +
| your site / app api key here
 
|}
 
|}
  
  
  
<br/>'''JSON Response:&nbsp;''' [http://api.globalquran.com/surah/114/quran-simple http://api.globalquran.com/surah/114/quran-simple]
+
<br/>'''JSON Response:&nbsp;''' [http://api.globalquran.com/surah/114/quran-simple http://api.globalquran.com/surah/114/quran-simple?key=api_key]
 
<pre class="prettyprint javascript">{
 
<pre class="prettyprint javascript">{
 
&nbsp;&nbsp;&nbsp; "quran": {
 
&nbsp;&nbsp;&nbsp; "quran": {
Line 80: Line 84:
 
<script>
 
<script>
 
$.ajaxSetup({ cache: true, jsonpCallback: 'quranData' }); // define ajax setup
 
$.ajaxSetup({ cache: true, jsonpCallback: 'quranData' }); // define ajax setup
$.getJSON("http://api.globalquran.com/surah/114/quran-simple?jsoncallback=?", {
+
$.getJSON("http://api.globalquran.com/surah/114/quran-simple?key=api_key&jsoncallback=?", {
 
     format&nbsp;: "jsonp"
 
     format&nbsp;: "jsonp"
 
}, function(data)
 
}, function(data)

Latest revision as of 03:34, 9 March 2014

Surah

Fetchs the quran data surah by surah. This will pull complete surah for specified surah number

Url: [http://api.globalquran.com/surah/getSurah/quranID http://api.globalquran.com/surah/getSurah/quranID?key=api_key]

attribute Value Description
getSurah surah number Identify here what surah number you want to pull
quranID quran id list of quran id seperated by | (pipe)
key api key your site / app api key here



JSON Response:  [http://api.globalquran.com/surah/114/quran-simple http://api.globalquran.com/surah/114/quran-simple?key=api_key]

{
    "quran": {
        "quran-simple": {
            "6231": {
                "surah": 114,
                "ayah": 1,
                "verse": "بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ قُلْ أَعُوذُ بِرَبِّ النَّاسِ"
            },
            "6232": {
                "surah": 114,
                "ayah": 2,
                "verse": "مَلِكِ النَّاسِ"
            },
            "6233": {
                "surah": 114,
                "ayah": 3,
                "verse": "إِلَٰهِ النَّاسِ"
            },
            "6234": {
                "surah": 114,
                "ayah": 4,
                "verse": "مِنْ شَرِّ الْوَسْوَاسِ الْخَنَّاسِ"
            },
            "6235": {
                "surah": 114,
                "ayah": 5,
                "verse": "الَّذِي يُوَسْوِسُ فِي صُدُورِ النَّاسِ"
            },
            "6236": {
                "surah": 114,
                "ayah": 6,
                "verse": "مِنَ الْجِنَّةِ وَالنَّاسِ"
            }
        }
    }
}



Examples:

Example: Loads the last surah 114.

<!DOCTYPE html>
<html>
<head>
  <style>#demo-1{ color:lightBlue; }</style>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
  <div id="demo-1">

</div>
<script>
$.ajaxSetup({ cache: true, jsonpCallback: 'quranData' }); // define ajax setup
$.getJSON("http://api.globalquran.com/surah/114/quran-simple?key=api_key&jsoncallback=?", {
    format : "jsonp"
}, function(data)
{    
    $.each(data.quran, function(i, by)
    {
	$.each(by, function (verseNo, line) {
            $("<p>").html(line.surah+':'+line.ayah+' '+line.verse).appendTo("#demo-1");
	});
    });
});
</script>
</body>
</html>

Demo:

Comments


blog comments powered by Disqus

.