# Variable from app.jl into script.js

**URL:** https://discourse.julialang.org/t/variable-from-app-jl-into-script-js/125387
**Category:** General Usage
**Tags:** plotting, genie, plotlyjs
**Created:** [January 30, 2025, 12:02pm UTC](https://discourse.julialang.org/t/variable-from-app-jl-into-script-js/125387 "2025-01-30T12:02:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ReLoneR](https://avatars.discourse-cdn.com/v4/letter/r/eb9ed0/32.png) [@ReLoneR](https://discourse.julialang.org/u/ReLoneR)
#### Post date: [January 30, 2025, 12:02pm UTC](https://discourse.julialang.org/t/variable-from-app-jl-into-script-js/125387/1 "2025-01-30T12:02:23Z")

</div>

Hi, lets say i have an app.jl that have this variables

`app.jl` :

```julia
...
@app begin
    @out firstX = [1, 2, 3, 4, 5]
    @out firstY = [5, 0, 3, -1, 2]
...
@page("/", "public/index_ui.jl.html", layout = "public/index_layout.jl")

```

Then in `index_ui.jl.html` i can use this two variables for example like this:

```julia
<plotly :data="[
{
  x: firstX,
  y: firstY,
  mode: 'lines',
  type: 'scatter',

```

My question is, how can i use this two variables in `script.js`, that is being used for this html file. Shoud script.js just see them, or should I do something different. I have this as an example right now:

`<div id="tester"></div>` (index\_ui.jl.html)

`script.js` :

```julia
TESTER = document.getElementById('tester');

Plotly.plot( TESTER, [{
     x: [1, 2, 3, 4, 5],
     y: [1, 2, 4, 8, 16] }], { 
     margin: { t: 0 } }, {showSendToCloud:true} );

```

When i change this to `x: firstX,` - it does not draw a graph anymore, so it does not know what a `firstX` is.

Any help,  
thanks
