Difference between revisions of "MediaWiki:Common.js"

From SaWikiLeaks
Jump to: navigation, search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
$(function () {
+
    $(function () {
             var lunchSpot = 0;
+
        $.ajax({
             $('#btn-random').click(function() {
+
             type: "GET",
                 lunchSpot = Math.floor((Math.random() * 10) + 1);
+
            url: 'http://sawikileaks.org/extra/lunchalgo.php',
                 switch (lunchSpot) {
+
             dataType: 'json',
                    case 1:
+
            success: function(jsondata){
                        lunchGo = "Saku (aka Sad Saku)";
+
                 console.log(jsondata.choices);
                        break;
+
                 $('#lunch-choices').html(jsondata.choices);
                    case 2:
+
            }
                        lunchGo = "CJ Lunch Box";
+
        });
                        break;
+
        $('#btn-random').click(function() {
                    case 3:
+
            $.ajax({
                        lunchGo = "CIBO";
+
                type: "GET",
                        break;
+
                url: 'http://sawikileaks.org/extra/lunchalgo.php',
                    case 4:
+
                dataType: 'json',
                        dalunchGoy = "Fynn's of Temple Bar";
+
                success: function(jsondata){
                        break;
+
                     $('#lunch-random').html(jsondata.percentages + '<br/>' + jsondata.choice);
                    case 5:
 
                        lunchGo = "Office Pub";
 
                        break;
 
                    case 6:
 
                        lunchGo = "Jack Astor's Bar & Grill";
 
                        break;
 
                    case 7:
 
                        lunchGo = "Nandos";
 
                        break;
 
                    case 8:
 
                        lunchGo = "Epicure";
 
                        break;
 
                    case 9:
 
                        lunchGo = "Gusto101";
 
                        break;
 
                     case 10
 
                        lunchGo = "Tosto";      
 
 
 
 
                 }
 
                 }
                $('#lunch-random').html(lunchGo);
 
 
             });
 
             });
         }());
+
         });
 +
    }());

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