2021-05-05

May 5 In-Class Exercise.

Post your solution to the May 5 In-Class Exercise to this thread.
Best,
Chris
Post your solution to the May 5 In-Class Exercise to this thread. Best, Chris

-- May 5 In-Class Exercise
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>JSONP 5/5/2021</title>
    <script>
      function findTotalResults(obj)
      {
        alert(obj.totalResults);
      }
    </script>
    <!-- for some reason the self-closing script tag wasn't working for me -->
    <script src="https://www.yioop.com/s/news?f=json&callback=findTotalResults"></script>
  </head>
  <body>
    <p>CS 174 JSONP In-Class Exercise, 5/5/2021</p>
  </body>
</html>
<pre> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>JSONP 5/5/2021</title> <script> function findTotalResults(obj) { alert(obj.totalResults); } </script> <!-- for some reason the self-closing script tag wasn't working for me --> <script src="https://www.yioop.com/s/news?f=json&callback=findTotalResults"></script> </head> <body> <p>CS 174 JSONP In-Class Exercise, 5/5/2021</p> </body> </html> </pre>

-- May 5 In-Class Exercise
<!DOCTYPE html> <html>
	<head>
		<title> JSONP </title>
	</head>
	<body>
		<script>
			function findTotalResults(obj) {
				alert(obj.findTotalResults);
			}
		</script>
		<script src="https://www.yioop.com/s/news/?f=json&callback=findTotalResults" />
	</body>
</html>
<!DOCTYPE html> <html> <head> <title> JSONP </title> </head> <body> <script> function findTotalResults(obj) { alert(obj.findTotalResults); } </script> <script src="https://www.yioop.com/s/news/?f=json&callback=findTotalResults" /> </body> </html>

-- May 5 In-Class Exercise
  <!DOCTYPE html>
  <html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>In-class exercise</title>
  </head>
  <body>
    <script>
        function findTotalResults(obj)
        {
            alert(obj.totalResults);
        }
    </script>
    <script src="https://www.yioop.com/s/news?f=json&callback=findTotalResults"></script>
 </body>
 </html>
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>In-class exercise</title> </head> <body> <script> function findTotalResults(obj) { alert(obj.totalResults); } </script> <script src="https://www.yioop.com/s/news?f=json&callback=findTotalResults"></script> </body> </html>

-- May 5 In-Class Exercise
<!DOCTYPE html> <head> </head> <body> <script>
	function findTotalResults(obj) {
		alert(obj.totalResults);
	}
</script> <script src="https://www.yioop.com/s/news?f=json&callback=findTotalResults"></script> </body> </html>
(Edited: 2021-05-05)
<!DOCTYPE html> <head> </head> <body> <script> function findTotalResults(obj) { alert(obj.totalResults); } </script> <script src="https://www.yioop.com/s/news?f=json&callback=findTotalResults"></script> </body> </html>

-- May 5 In-Class Exercise
 <!DOCTYPE html>
 <html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
 </head>
 <body>
  <script>
    function findTotalResults(obj){
      alert(`the total number of results: ${obj.totalResults}`);
    }
  </script>
  <script src="https://yioop.com/s/news?f=json&callback=findTotalResults"></script>
 </body>
 </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <script> function findTotalResults(obj){ alert(@BT@the total number of results: ${obj.totalResults}@BT@); } </script> <script src="https://yioop.com/s/news?f=json&callback=findTotalResults"></script> </body> </html>

-- May 5 In-Class Exercise
Exercise 5/5 function findTotalResults(results) { alert(results.totalResults); }
(Edited: 2021-05-05)
<nowiki> <!doctype HTML> <html lang='en-US'> <head> <meta charset="utf-8"/> <title>Exercise 5/5</title> </head> <body> <script> function findTotalResults(results) { alert(results.totalResults); } </script> <script src="https://www.yioop.com/s/news?f=json&callback=findTotalResults"> </script> </body> </html> </nowiki>

-- May 5 In-Class Exercise
<!DOCTYPE html> <html lang="en">
  <head>
    <title>In-Class Exercise</title>
  </head>
  <body>
    <script>
        function findTotalResults(obj)
        {
            alert(obj.totalResults);
        }
    </script>
    <script src="https://www.yioop.com/s/news?f=json&callback=findTotalResults"></script>
 </body>
 </html>
<!DOCTYPE html> <html lang="en"> <head> <title>In-Class Exercise</title> </head> <body> <script> function findTotalResults(obj) { alert(obj.totalResults); } </script> <script src="https://www.yioop.com/s/news?f=json&callback=findTotalResults"></script> </body> </html>

-- May 5 In-Class Exercise
May 5 function findTotalResults(results) { alert(results.totalResults); }
<nowiki> <!DOCTYPE html> <head> <title>May 5</title> <meta charset="UTF-8"/> </head> <body> <script> function findTotalResults(results) { alert(results.totalResults); } <script> <script src="https://www.yioop.com/s/news?f=json&callback=findTotalResults" /> </body> </html> </nowiki>

-- May 5 In-Class Exercise
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<script>
function findTotalResults(obj) {
	alert("total results": obj.totalResults)
}
</script> 
<body>
<script src="https://www.yioop.com/s/news?f=json&callback=findTotalResults"></script>
</body>
</html>
(Edited: 2021-05-05)
<pre> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <script> function findTotalResults(obj) { alert("total results": obj.totalResults) }</pre><pre> </script> <body> <script src="https://www.yioop.com/s/news?f=json&callback=findTotalResults"></script> </body> </html> </pre>
[ Next ]
X