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

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

<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

&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; JSONP &lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;script&gt; function findTotalResults(obj) { alert(obj.findTotalResults); } &lt;/script&gt; &lt;script src=&quot;https://www.yioop.com/s/news/?f=json&amp;callback=findTotalResults&quot; /&gt; &lt;/body&gt;

&lt;/html&gt;

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

&lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot; dir=&quot;ltr&quot;&gt; &lt;head&gt; &lt;meta charset=&quot;utf-8&quot;&gt; &lt;title&gt;In-class exercise&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;script&gt; function findTotalResults(obj) { alert(obj.totalResults); } &lt;/script&gt;

<script src="https://www.yioop.com/s/news?f=json&callback=findTotalResults"></script>

&lt;/body&gt; &lt;/html&gt;

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

&lt;!DOCTYPE html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;script&gt; function findTotalResults(obj) { alert(obj.totalResults); } &lt;/script&gt; &lt;script src=&quot;https://www.yioop.com/s/news?f=json&amp;callback=findTotalResults&quot;&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt;

(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

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

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

&lt;nowiki&gt; &lt;!doctype HTML&gt; &lt;html lang=&#039;en-US&#039;&gt; &lt;head&gt; &lt;meta charset=&quot;utf-8&quot;/&gt; &lt;title&gt;Exercise 5/5&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;script&gt; function findTotalResults(results) { alert(results.totalResults); } &lt;/script&gt; &lt;script src=&quot;https://www.yioop.com/s/news?f=json&amp;callback=findTotalResults&quot;&gt; &lt;/script&gt;

&lt;/body&gt; &lt;/html&gt;

&lt;/nowiki&gt;

(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

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

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

&lt;nowiki&gt; &lt;!DOCTYPE html&gt; &lt;head&gt; &lt;title&gt;May 5&lt;/title&gt; &lt;meta charset=&quot;UTF-8&quot;/&gt; &lt;/head&gt; &lt;body&gt;

&lt;script&gt; function findTotalResults(results) { alert(results.totalResults); } &lt;script&gt; &lt;script src=&quot;https://www.yioop.com/s/news?f=json&amp;callback=findTotalResults&quot; /&gt; &lt;/body&gt; &lt;/html&gt; &lt;/nowiki&gt;

<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

&lt;pre&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset=&quot;utf-8&quot;&gt; &lt;/head&gt; &lt;script&gt; function findTotalResults(obj) { alert(&quot;total results&quot;: obj.totalResults) }&lt;/pre&gt;&lt;pre&gt; &lt;/script&gt; &lt;body&gt; &lt;script src=&quot;https://www.yioop.com/s/news?f=json&amp;callback=findTotalResults&quot;&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; &lt;/pre&gt;

(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