Zookal
Zookal

We’d love to hear any feedback or comment from you!

© 2011-2021 Zookal Pty Ltd

View question and answer

From our collection of questions and answers
Engineering · Computer Science
Question details

CSS/HTML Question:

So, I am trying use a JSON array from a URL, and convert it into an array on brackets, and use the array that I gathered from online in my html. I know I am close, but there is something I am doing wrong, and my JS file isn't working. I can't seem to figure out what my mistake is, so can you guys look at my JS and HTML file and show me how I can fix this issue.

Thank you.

1 /1 converts a json file from a url to an array var xmlhttp new XMLHttpRequest(); 3 var urlhttp://movieroulette.net/movieArray.json; 4 5 ▼ xmlhttp . onreadystatechange = function() { 6 ▼ if (xmlhttp. readyState 4 && xmlhttp. status == 200) { var theArray JSON . parse(xmlhttp. responseText); getRandomMovie(theArray); 9 10 11 xmlhttp.open (GET, url, true); 12 xmlhttp.send ); 16 // Picks a movie from the array. 17 function getRandomMovie(theArray) 18 19 20 21 var randNum var htmlArray var imgArray I randNum Math.floor (Math.random() arr.length); if (randNum く 0) if (randNum >Ξ arr. length) 23 24 25 26 27 28 29 30 31 32 randNum: randNumarr.length 1; htmlArray +- Want to Learn More? CLICK ingArray += 、<ing src=images/ + randNum-..jpg>、; HERE!; 34 35 36 37 38 39 40 document.getElementById( a r rName).innerHTML = arr[randNum].name ; document.getElementById (arrGenre).innerHTMLarr[randNum].genre; document.getElementById(arrYear).innerHTMLarr[randNum].year; document.getElementById( a r rRating).innerHTML Ξ arr[randNum].rating; document.getElementById( a r rRuntíme).innerHTML arr [randNum].runtime ; document.getElementById(arrURL).innerHTML htmlArray; document.getElementById(arrTmg). ÎnnerHTML İmgArray; 42

1 <!DOCTYPE html> 2 ▼ <html> head> <title>Movie Roulette</title> <script type=text/javascript <style> 4 src=http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js></script> @import url(https://fonts.googleapis.com/css?family Concert+One) </style> <style type:text/css div#mydi vision font-family: Concert One margin: 0; position: absolute; top : 50%; Left: 5Θ%; margin-right: -50%; transform: translate(-50%, padding-top : 0%; 12 15 16 17 18 19 20 21 -50%); imgf padding-right: 30px; height: 390px; width: 260px; 24 25 26 /style> </head> 28 29 Y 30 31 32 ▼ 33 ▼ 34 35 36 37 ▼ 38 39 40 Y 41 42 <body> <center> <div id mydivision> <table borderzO <tr> th rowspan-6><div id-arrImg</div></th> <td><h1>Your Movie for Tonight is: <font color=red><div id=arrName></div></font></h1></td> </tr> <tr> <td><h2>Genre: <font color=red><span id=arrGenre></span></font></h2></td> </tr> <tr> <td><h2>Year: <font color=red ><span id=arrYear></span></font></h2></td> </tr> <tr> <td><h2>Rated: <font color=red><span id=arrRating></span></font></h2></td> </tr> <tr> 46 ▼ 47 48 49 ▼ 50 51 52 53 54 <td> ch2>Runtime: <font color-red><span id-arrRuntime></span></font></h2></td> </tr> <tr> <td><h2><span id=arrURL></span></h2></td> </tr> </table> /div> </center> 56 57 </html> 58 </body>

Answer
Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.

Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.