<!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>
<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>
<!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>
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> <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>
<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> <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)