+ Start a Discussion
KamindiaKamindia 

Writing Javascript Code in Apex Classes

Hello,

Could anybody help me in the below scenario.

Currently we have application in some other language and we are trying to migrate it to salesforce.

In the application  Javascript is dynamically created in code which generate the UI part.So I am trying for the same functionality that I need to write the same Javascript code through Apex Code which dynamically generate the interface.

Is it possible to write whole javascript in apex Code and what need to be taken care when moving(migrating) the same to Force.com

avijchakavijchak

class

public String scriptStr {get;set;} { scriptStr = 'alert(\'Hi\')' ;}

 

page

 

<script>

   {!scriptStr}

</script>

 

Hope it will work