Difference between revisions of "MediaWiki:Common.js"
From SaWikiLeaks
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | $(function () { | + | $(function () { |
| − | $('#btn-random').click(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); | ||
| + | } | ||
}); | }); | ||
| − | }()); | + | }); |
| + | }()); | ||
Latest revision as of 13:33, 9 May 2017
$(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);
}
});
});
}());