Reputation: 41
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
Upvotes: 1
Views: 1463
Reputation: 458
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>
Upvotes: 1
Reputation: 1465
You need to include jQuery;
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
Add this code inside of head tags
Upvotes: 2