Re: [Dev] [Jaggery] Calling javascript function from .Jag file
Hi All, Yes, the issue was regarding directly calling a client-side function. Therefore passed the required attributes through a session, and called the functions from the client-side. Thanks, On Tue, May 26, 2015 at 10:13 AM, Sajith Ariyarathna sajit...@wso2.com wrote: Hi Himasha, Jaggery scripts runs in the server-side. Hence, you cannot use client-side JavaScript functions such as 'alert'. Please make sure that /js/actions.js have only server-side functions. Thank you. On Mon, May 25, 2015 at 10:57 AM, Himasha Guruge himas...@wso2.com wrote: Hi All, I have a .jag file(startProcess.jag) that needs to call a javascript function (showStatus()). In the .jag, I have added a require statement to get the .js file and calling the function through that like below. var process = require(/js/actions.js); process.showStatus(id); In the controller all the jags are included, and jquery/bootstrap references are added in footer.jag. My controller looks like below. include(/template/startProcess.jag); ... include(/template/partials/footer.jag); But at the execution of the process, it gives undefined error for methods such as 'alert'. (Methods that are used within showStatus()). What could be the reason for this? I came across [1] , so if this is the same issue in this scenario as well, is there any workaround? [1] http://stackoverflow.com/questions/1125/referenceerror-alert-is-not-defined Thanks, Himasha Guruge *Software Engineer* WS*O2* *Inc.* Mobile: +94 777459299 himas...@wso2.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- Sajith Ariyarathna Software Engineer; WSO2, Inc.; http://wso2.com/ mobile: +94 77 6602284, +94 71 3951048 -- Himasha Guruge *Software Engineer* WS*O2* *Inc.* Mobile: +94 777459299 himas...@wso2.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] [Jaggery] Calling javascript function from .Jag file
Hi Himasha, AFAIU, Are you calling a javascript alert() function within a .jag script? If so, that should be the problem. We cannot call client-side javascript functions like alert() at server-side jaggery layer. Cheers, Dilan. *Dilan U. Ariyaratne* Software Engineer WSO2 Inc. http://wso2.com/ Mobile: +94775149066 lean . enterprise . middleware On Mon, May 25, 2015 at 10:57 AM, Himasha Guruge himas...@wso2.com wrote: Hi All, I have a .jag file(startProcess.jag) that needs to call a javascript function (showStatus()). In the .jag, I have added a require statement to get the .js file and calling the function through that like below. var process = require(/js/actions.js); process.showStatus(id); In the controller all the jags are included, and jquery/bootstrap references are added in footer.jag. My controller looks like below. include(/template/startProcess.jag); ... include(/template/partials/footer.jag); But at the execution of the process, it gives undefined error for methods such as 'alert'. (Methods that are used within showStatus()). What could be the reason for this? I came across [1] , so if this is the same issue in this scenario as well, is there any workaround? [1] http://stackoverflow.com/questions/1125/referenceerror-alert-is-not-defined Thanks, Himasha Guruge *Software Engineer* WS*O2* *Inc.* Mobile: +94 777459299 himas...@wso2.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] [Jaggery] Calling javascript function from .Jag file
Hi Himasha, Jaggery scripts runs in the server-side. Hence, you cannot use client-side JavaScript functions such as 'alert'. Please make sure that /js/actions.js have only server-side functions. Thank you. On Mon, May 25, 2015 at 10:57 AM, Himasha Guruge himas...@wso2.com wrote: Hi All, I have a .jag file(startProcess.jag) that needs to call a javascript function (showStatus()). In the .jag, I have added a require statement to get the .js file and calling the function through that like below. var process = require(/js/actions.js); process.showStatus(id); In the controller all the jags are included, and jquery/bootstrap references are added in footer.jag. My controller looks like below. include(/template/startProcess.jag); ... include(/template/partials/footer.jag); But at the execution of the process, it gives undefined error for methods such as 'alert'. (Methods that are used within showStatus()). What could be the reason for this? I came across [1] , so if this is the same issue in this scenario as well, is there any workaround? [1] http://stackoverflow.com/questions/1125/referenceerror-alert-is-not-defined Thanks, Himasha Guruge *Software Engineer* WS*O2* *Inc.* Mobile: +94 777459299 himas...@wso2.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- Sajith Ariyarathna Software Engineer; WSO2, Inc.; http://wso2.com/ mobile: +94 77 6602284, +94 71 3951048 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
[Dev] [Jaggery] Calling javascript function from .Jag file
Hi All, I have a .jag file(startProcess.jag) that needs to call a javascript function (showStatus()). In the .jag, I have added a require statement to get the .js file and calling the function through that like below. var process = require(/js/actions.js); process.showStatus(id); In the controller all the jags are included, and jquery/bootstrap references are added in footer.jag. My controller looks like below. include(/template/startProcess.jag); ... include(/template/partials/footer.jag); But at the execution of the process, it gives undefined error for methods such as 'alert'. (Methods that are used within showStatus()). What could be the reason for this? I came across [1] , so if this is the same issue in this scenario as well, is there any workaround? [1] http://stackoverflow.com/questions/1125/referenceerror-alert-is-not-defined Thanks, Himasha Guruge *Software Engineer* WS*O2* *Inc.* Mobile: +94 777459299 himas...@wso2.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev