Javascript in Methods or class methods
Hi Guys,
I've this client method in my Zen page which looks good and compile fine:
I first tried calling this clientmethod in %DrawHTML() like : var res=zenPage.getNewPrinters(); but for some reason didn't work not sure why I even tried simplifying my clientMethod with simple code like just showing alert but still this call didn't work
So now I'm trying copying the code of my clientmethod to %DrawHTML() but I'm getting a compilation error not sure why everything is the same so why is this code is raising a compalation error when placed between &js<> and working fine in my clientMethod?
I actually tried copying this code to other classMethods placing it insode &js<> and still get the same compilation problem, I'm starting to this that this type of javascript syntax in not compliant in &js<> !?
so what I'm doing wrong?
Thanks
The issue is just in `<` sign in the javascript code, replace it with something else, without <>.
Or use extra symbol for &js, like @, see example
ClassMethod OnPage() As %Status { &js@< if ( a > 1) { console.log('test') } >@ Quit $$$OK }
Thanks Dmitry.