Created
December 24, 2013 01:18
-
-
Save aficionado/8107426 to your computer and use it in GitHub Desktop.
Example for Petar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
html, body{ | |
height: 100%; | |
} | |
*, *:before, *:after { | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
box-sizing: border-box; | |
} | |
body { | |
font: 14px/18px "Helvetica Neue", Helvetica, Arial, sans-serif; | |
margin: 0; | |
position: relative; | |
background: #fff; | |
display: block; | |
color: #333; | |
} | |
.clearfix:after { | |
visibility: hidden; | |
display: block; | |
font-size: 0; | |
content: " "; | |
clear: both; | |
height: 0; | |
} | |
.clearfix { display: inline-table; } | |
* html .clearfix { height: 1%; } | |
.clearfix { display: block; } | |
#wrap{ | |
min-height: 100%; | |
height: auto; | |
margin: 0 auto -60px; | |
padding: 0 0 60px; | |
} | |
#header{ | |
height: 100px; | |
background: #F7F7F7; | |
border-bottom: 1px solid #D6D8D9; | |
border-top: 4px solid #293A44; | |
} | |
#header img{ | |
margin-top: 10px; | |
} | |
#footer { | |
height: 60px; | |
background-color: #293A43; | |
color: #5D6F79; | |
text-align: center; | |
font-size: 11px; | |
padding-top: 20px; | |
} | |
.container{ | |
width: 980px; | |
margin: 0 auto; | |
padding: 0 30px; | |
} | |
#predictions { | |
float: left; | |
width: 720px; | |
margin-top: 30px; | |
} | |
</style> | |
<body> | |
<div id="wrap"> | |
<div id="header"> | |
<div class="container clearfix"> | |
<a href="https://bigml.com/" target="_blank"><img alt="bigml" src="https://static.bigml.com/static/img/bigml.png"></a> | |
</div> | |
</div> | |
<div class="container clearfix"> | |
<div id="predictions"></div> | |
</div> | |
</div> | |
<div id="footer"> | |
Copyright © 2013 BigML, Inc. | |
</div> | |
</body> | |
<script src="http://code.jquery.com/jquery-1.7.1.js" type="text/javascript"></script> | |
<script> | |
// Loads multiple predictions | |
var loadPredictions = function(options) { | |
var settings = $.extend({ | |
callback: function() {}, | |
urls: [ | |
'https://bigml.io/andromeda/prediction/52b8d90e035d07251200da07?username=francisco;api_key=e9b49e43fd6d591c2b9c14c16c4ddcbbde6ba1d3', | |
'https://bigml.io/andromeda/prediction/52a0bd69035d0779dd000445?username=francisco;api_key=e9b49e43fd6d591c2b9c14c16c4ddcbbde6ba1d3', | |
], | |
predictions: [] | |
}, options || {}); | |
$.ajax({ | |
url : settings.urls[settings.predictions.length], | |
dataType: 'jsonp', | |
crossDomain:true, | |
success: function(prediction) { | |
result = { | |
"output": prediction.output} | |
settings.predictions.push(result); | |
if (settings.predictions.length < settings.urls.length) { | |
loadPredictions(settings); | |
} else { | |
settings.callback(settings.predictions); | |
} | |
} | |
}); | |
}; | |
</script> | |
<script> | |
loadPredictions({ | |
callback: function(predictions) { | |
var text = ""; | |
for (var i=0; i<predictions.length; i++) { | |
text += predictions[i].output + " "; | |
} | |
$('#predictions').html(text); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment