I am trying to pull json down from my server and parse it into a Javascript object. here is what my json looks like:
{
"tour1": [
{
"title": "building1",
"description": "Tour of building1",
"image": "Icon.png",
"video": "tour.mp4",
"length": "0.00",
"version": "1.0",
"timestamp": "1111111111"
}
]
}
Here is the requst to the server:
<!DOCTYPE html>
<html>
<body>
<h2>Parse JSON from Server</h2>
<p id="demo"></p>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"> </script>
<script>
$.ajax({
url: "mysite.com/videos/tour.json";
var j = [];
$.ajax({
type: 'GET',
url: url,
dataType: 'json',
});
window.alert(j.tour1[0].title);
</script>
</body>
</html>
I cant understand why its not working. I am new to javascript. I appreciate any help with this issue.