Is it possible to load async a HTML5 canvas (a js file) from server and render it in a HTML page?
This is my scenario: I have to display a diagram in a HTML page. The diagram is displayed as a HTML5 canvas. Because the diagram can be very complex it can take some time to be generated. What I'd like to do is to display the HTML page to the user and show a loading indicator while the diagram is generated on the server. The diagram is generated as a js file containing the methods to render the diagram on the canvas.
After the diagram is generated it is loaded in the page and rendered in the canvas.
What I don't know is how to load the js file from the server once it has been generated and execute it on the client in order to render the diagram.
If my approach is not valid, I'm open to suggestions.