Same error despite using Daniel's recommended function syntax (call hype js function from external HTML)

(Quint Rahaman) #1

Continuing the discussion from How to call hype js function from external HTML:

The following is the function in my external js file:


“See” is the name of my hype document and “highchartsPlot” is the name of the function in my hype document.

My hype document is embedded on a WordPress page. A js file is loaded upon document load. This js file contains an ajax function which is intended to save data to the WordPress mysql database. The hype document functions swimmingly. As the user moves through the scene, data is collected and once completed, the ajax function is invoked, the data is saved to the database and the ajax response returns that data as intended. This works great!

The objective is to push that data back to the hype document so that it can be graphed using the highcharts charting library. I have tested this initially in Hype with static test data which works flawlessly.

Should this code not work? HYPE.documents['See'].functions().highchartsPlot(hypeDocument,element,event);

The error returned is: Uncaught ReferenceError: hypeDocument is not defined

Any direction would be much appreciated…

(Mark Hunte) #2

Replaces hypeDocument so you need to do the same for all occurrences of hypeDocument.

You also will get an error with element you have to either declare and define it or use a string as an argument. The event should be ok.

(Quint Rahaman) #3

Two words: You rock!

Thank you very much for your help.


Thanks for this – I’ve updated that thread to fix my code.