Difference between revisions of "MediaWiki:Common.js"

From SaWikiLeaks
Jump to: navigation, search
 
Line 1: Line 1:
<script>
 
   
 
 
     $(function () {
 
     $(function () {
 
         $.ajax({
 
         $.ajax({
Line 22: Line 20:
 
         });
 
         });
 
     }());
 
     }());
   
 
    </script>
 

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);
                }
            });
        });
    }());