Include canvasJS diagram on another page
I don't know why I can't include canvasJS with JavaScript on another page.
<script type="text/javascript">
$(document).ready(function() {
$("input[name='btn']").click(function() {
var vValue = document.getElementById("value").value;
var testValue = document.getElementById("test").value;
var projValue = document.getElementById("project").value;
$("#parent").load('/index.php/grafic/view/proiect1/1/2');
});
});
</script>
I am using these values ββ(vValue, testValue, projValue), but in this case I was trying to check: if the values ββare correct, I use .alert()
to see if it accepts those values. In index.php / grafic / view / project1 / 1/2 page, I have a canvasJS drawing that works if I enter this page.
Part of my JS code:
<script type="text/javascript">
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer",
{
exportEnabled: true,
title:{
text: "<?php echo $nume; ?>"
},
axisY:{
title:"Number of runs"
},
legend: {
---//---
</script>
<script type="text/javascript" src="/css/canvasjs.min.js"></script>
<div id="chartContainer" style="height: 300px; width: 1100px;"></div>
So my problem is that after I click the button, this diagram does not appear in the parent div, but if I write text on this page, it will be shown in the parent div.
+3
source to share