Elixir list

def index(conn, _params) do

    file =  get_files()
    users =


      |> Enum.map(&%{&1 | id: sign_user_id(conn, &1.id)})

    page = %{first: "Users", last: "View users"}

    render(conn, "index.html", users: users, page: page, file: file)


am sending a param called file as list e.g [“26_000028_2020-12-07.pdf”, “coi.pdf”, “zicb.pdf”] to frontend where i have a script. How to do i pass this list to JS varaiable pdf in the script

<script type="text/javascript">

    var slider_content = document.getElementById('box');


    var pdf = ['/pdf/26_000028_2020-12-07.pdf', '/pdf/zicb.pdf'];

    var i = pdf.length;

    // function for next slide 

    function nextpdf(){

        if (i<pdf.length) {

            i= i+1;


            i = 1;


          slider_content.innerHTML = "<embed src="+pdf[i-1]+">";


    // function for prew slide

    function prewpdf(){

        if (i<pdf.length+1 && i>1) {

            i= i-1;


            i = pdf.length;


          slider_content.innerHTML = "<embed src="+pdf[i-1]+">";



2 ways, either you do a separate fetch() on a small json, or hide it in the DOM, via a data attribute on some element: