Passing objects to client in node + express + jade?

后端 未结 1 566
[愿得一人]
[愿得一人] 2020-12-04 09:52

I have a pretty heavyweight query on the server that results in a new page render, and I\'d like to pass along some of the results of the query to the client (as a javascrip

相关标签:
1条回答
  • 2020-12-04 10:28

    You can't inline a JS object like that, but you can JSON.stringify it before:

    <script type="text/javascript">
      var data = !{JSON.stringify(data)};
    </script>
    
    0 讨论(0)
提交回复
热议问题