Difference between revisions of "MediaWiki:Common.js"
From SaWikiLeaks
Line 1: | Line 1: | ||
$(function () { | $(function () { | ||
− | |||
$('#btn-random').click(function() { | $('#btn-random').click(function() { | ||
− | + | $.ajax({ | |
− | + | type: "GET", | |
− | + | url: 'lunchalgo.php', | |
− | + | dataType: 'json', | |
− | + | success: function(jsondata){ | |
− | + | console.log(jsondata); | |
− | + | $('#lunch-random').html(jsondata.percentages + '<br/>' + jsondata.choice); | |
− | + | } | |
− | + | }); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
}); | }); | ||
}()); | }()); |
Revision as of 15:32, 31 March 2017
$(function () { $('#btn-random').click(function() { $.ajax({ type: "GET", url: 'lunchalgo.php', dataType: 'json', success: function(jsondata){ console.log(jsondata); $('#lunch-random').html(jsondata.percentages + '<br/>' + jsondata.choice); } }); }); }());