Home Forums Chart Support Collection data with Ajax Reply To: Collection data with Ajax

#10587

@ask123,

Generally JavaScript code will function in the head before code in the body. The head section is usually used to contain information about the page that you don’t necessarily see like the meta keywords meta description or title of a page.

Here in your case, Buttons with id ‘chart1’ and ‘chart2’ are created after script is run, but where it fails to fetch buttons with those ids. You can move script tag to body so that it works fine. Here is your working code.

Render Multiple Charts on Button Click

Refer these links for more info on placement of JavaScript code.
TutorialPoints
W3Schools
Stackoverflow

—-
Vishwas R
Team CanvasJS

  • This reply was modified 8 years, 1 month ago by Vishwas R.