Sunday 21 May 2017

Need to render variable from route to use in client-side javascript

I am currently able to use variables in the view that I render from the route but only in the HTML markup. How can I use these same variables in the client-side javascript?

I have this code:

<script>
  var socket = io();

if ( === ) {
  socket.on('outbid', function () {
    console.log('You have been outbid');
  });
}

</script>

However, the variables are not being passed in correctly because I'm just getting an undefined.



via kolbykskk

No comments:

Post a Comment