I don't know why I can't include a 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 use those values (vValue, testValue, projValue) but in this case I was trying a test: if the values are correct I use an .alert()
to see if it takes these values.
On the page index.php/grafic/view/project1/1/2 I have a canvasJS graphic that works if I enter on that page.
A 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, in the parent div that chart will not appear, but if I write some text on that page, it will show in the parent div.