Message from JavaScript discussions

March 2019

— Had a rookie doubt


Can we create two functions that render something inisde a separate js file and export it to the main file and get both those results from the two functions on our screen

— Try to import this two functions (components) in main file.

— It didn't work.

— The global variable remains undefined.

— Try that: window.res = result;

— What do you mean? I need to assign value to result, not res.

— As you wrote it is wrong, take for example jquery which uses the alias $ and assigns it to the jQuery function

Message permanent page

— I have tried your method, but I still got undefined.

— Https://

— I know, but it has no effect.

— I can assign value to global variable outside jquery ajax.