Difference between revisions of "MediaWiki:Common.js"

From SaWikiLeaks
Jump to: navigation, search
Line 7: Line 7:
 
                     success: function(jsondata){
 
                     success: function(jsondata){
 
                         console.log(jsondata);
 
                         console.log(jsondata);
                         $('#lunch-random').html(jsondata.percentages + '<br/>' + jsondata.choice);
+
                         $('#lunch-random').html('<br/>' + jsondata.percentages + '<br/>' + jsondata.choice);
 
                     }
 
                     }
 
                 });
 
                 });
 
             });
 
             });
 
         }());
 
         }());

Revision as of 15:34, 31 March 2017

$(function () {
            $('#btn-random').click(function() {
                $.ajax({
                    type: "GET",
                    url: 'http://sawikileaks.org/extra/lunchalgo.php',
                    dataType: 'json',
                    success: function(jsondata){
                        console.log(jsondata);
                        $('#lunch-random').html('<br/>' + jsondata.percentages + '<br/>' + jsondata.choice);
                    }
                });
            });
        }());