1

I have a stand alone html notepad which I need to run the following code.

jQuery(function($)
    {
        $
            .getJSON(
            'http://muslimsalat.com/daily.json?key=562736259fca2971c0f7b4cc838f1ecf',
            function(times)
            {
                $('.prayerTimesExample')
                    .append('Today in ' + times.title)
                    .append(' Fajr: ' + times.items[0].fajr)
                    .append(' Dhuhr: ' + times.items[0].dhuhr)
                    .append(' Asr: ' + times.items[0].asr)
                    .append(' Maghrib: ' + times.items[0].maghrib)
                    .append(' Isha: ' + times.items[0].isha)
                    .append(
                        ' by <a href="http://MuslimSalat.com">MuslimSalat.com</a>');
            });
    });'

So I made a the following html code but when i run it nothing happens

<!DOCTYPE html>
<html>
<head>

</head>

<body>
    <div class="prayerTimesExample"></div>
<script>
    jQuery(function($)
    {
        $
            .getJSON(
            'http://muslimsalat.com/daily.json?key=562736259fca2971c0f7b4cc838f1ecf',
            function(times)
            {
                $('.prayerTimesExample')
                    .append('Today in ' + times.title)
                    .append(' Fajr: ' + times.items[0].fajr)
                    .append(' Dhuhr: ' + times.items[0].dhuhr)
                    .append(' Asr: ' + times.items[0].asr)
                    .append(' Maghrib: ' + times.items[0].maghrib)
                    .append(' Isha: ' + times.items[0].isha)
                    .append(
                        ' by <a href="http://MuslimSalat.com">MuslimSalat.com</a>');

            });
    });
</script>
</body>
</html>

Here is the jfiddle i made http://jsfiddle.net/axL0u0q6/ Thank you Hope Im clear

  • Your code is using jQuery library. You should add `` or similar to your ``. In jsfiddle, use the libraries dropdown on the left side to choose jQuery. – Amadan Oct 24 '14 at 03:13

2 Answers2

2

You need to include jQuery;

<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>

Add this code inside of head tags

musa
  • 1,457
  • 18
  • 37
1

jQuery is a library you need to include first.

<head>
     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
JonasB
  • 458
  • 3
  • 9