Difference between revisions of "MediaWiki:Common.js"
From SaWikiLeaks
Line 1: | Line 1: | ||
− | $(function () { | + | <script> |
− | $('#btn-random').click(function() { | + | |
− | + | $(function () { | |
− | + | $.ajax({ | |
− | + | type: "GET", | |
− | + | url: 'http://sawikileaks.org/extra/lunchalgo.php', | |
− | + | dataType: 'json', | |
− | + | success: function(jsondata){ | |
− | + | console.log(jsondata.choices); | |
− | } | + | $('#lunch-choices').html(jsondata.choices); |
+ | } | ||
+ | }); | ||
+ | $('#btn-random').click(function() { | ||
+ | $.ajax({ | ||
+ | type: "GET", | ||
+ | url: 'http://sawikileaks.org/extra/lunchalgo.php', | ||
+ | dataType: 'json', | ||
+ | success: function(jsondata){ | ||
+ | $('#lunch-random').html(jsondata.percentages + '<br/>' + jsondata.choice); | ||
+ | } | ||
}); | }); | ||
− | }()); | + | }); |
+ | }()); | ||
+ | |||
+ | </script> |
Revision as of 13:33, 9 May 2017
<script> $(function () { $.ajax({ type: "GET", url: 'http://sawikileaks.org/extra/lunchalgo.php', dataType: 'json', success: function(jsondata){ console.log(jsondata.choices); $('#lunch-choices').html(jsondata.choices); } }); $('#btn-random').click(function() { $.ajax({ type: "GET", url: 'http://sawikileaks.org/extra/lunchalgo.php', dataType: 'json', success: function(jsondata){ $('#lunch-random').html(jsondata.percentages + '<br/>' + jsondata.choice); } }); }); }()); </script>