flask-chartist-example/app/templates/matplotlib.js

11 lines
323 B
JavaScript

function updateChartSrc(){
var nation = $("#nation option:selected").text()
var updatedData = $.get('/mpl/'.concat(nation));
updatedData.done(function(results){
$("img[name=population]").attr("src", results.src)
});
}
$( document ).ready(updateChartSrc)
$("#nation").on('change', updateChartSrc);