how to set value of text field in html from nodejs?

后端 未结 2 1396
猫巷女王i
猫巷女王i 2020-12-07 06:00

I\'m doing project in nodejs and html .can anybody help how to set value to text field in html from server.js. For example I\'ve text field with id \'name\' on index.html.

2条回答
  •  被撕碎了的回忆
    2020-12-07 06:25

    You can't set a client-side thing from the server-side. They're absolutely different physical layers.

    What you need is AJAX to request a resource from your Web app to your NodeJS server-side app, and set what you put in you response to the whole text field.

    Maybe you'll need to take a look at ExpressJS to build a simple RESTful service to share resources between your client and server tiers.

提交回复
热议问题