ExpressJS Pass variables to JavaScript

后端 未结 5 1354
谎友^
谎友^ 2021-02-07 12:35

I am completely lost on this; I am using NodeJS to fetch a JSON and I need to pass the variable to my page and have JavaScript use the data.

app.get(\'/test\', f         


        
5条回答
  •  北恋
    北恋 (楼主)
    2021-02-07 13:17

    Well, Javascript (and V8) has a built in function to render JSON from a object, and JSON happens to be syntactially compatible with Javascript.

    So the easiest way to do what your trying to do would be:

    
    
                                     
                  
提交回复
热议问题