Only index.js can use nodejs, but sub.js cannot use nodejs. please tell me how to solve it
https://replit.com/@korea-vote/chat?v=1
It does not use node as it is fronted, and node is backend. here is an article explaining the difference: The Difference Between Front-End vs. Back-End | ComputerScience.org
3 Likes
Is there any way to use nodejs in sub.js as well?
1 Like
Not directly, but you could use xmlhttpreqest to send info to index.js and run the node stuff there. So you can’t run node stuff but you can communicate to something that does.
Honestly the fetch
API is a better method, it’s much more simple and it’s more ‘modern’.
2 Likes
please give me example code
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.