0
我想將DONUT CHART從另一個頁面加載到當前頁面。 - 一些當我點擊主頁按鈕更贖罪,我想dispaly圖-page.php文件的圖表外部頁面使用jquery加載事件加載圖形頁面時不加載Morris圖表
注:當我手動運行Graph_page.php它的正常工作
Home.php
<input class="button" type="button" />
<div class="home"></div>
<script>
$(document).ready(function(){
$(".button").click(function(){
$(".home").load("Graph_page.php", function(responseTxt, statusTxt, xhr){
if(statusTxt == "success")
//success alert
if(statusTxt == "error")
//error alert
});
});
});
</script>
Graph_page.php
<div class="box-body chart-responsive">
<div class="chart" id="sales-chart" position: relative;"></div>
</div>
//script DONUT CHART
<script type="text/javascript">
$(function() {
"use strict";
var donut = new Morris.Donut({
element: 'sales-chart',
resize: true,
colors: ["#f56954","#00a65a","#3c8dbc"],
data: [
{label: "Absent Days", value: 5},
{label: "Present Days", value: 10},
{label: "Working Days", value: 15}
],
hideHover: 'auto'
});
});
</script>
非常感謝它對我來說絕對很好 –