【发布时间】:2021-02-04 13:30:52
【问题描述】:
我需要从 SERVER1 上运行的应用程序向 SERVER2 上运行的应用程序发出 POST 请求。
SERVER1:
<form name="submitForm" method="POST" action="http://SERVER2:4120/download_item/">
<input type="hidden" name="item_field" value="G78328">
<a href="javascript:document.submitForm.submit()">Click on the link</a>
</form>
SERVER2:
router.post('/download_item', async function(req, res) {
itemid= req.body.item_field;
});
当我在同一服务器 (localhost) 上运行这两个应用程序时,此方法有效,但在不同服务器上无效。
【问题讨论】:
-
你能从
SERVER1ping 到SERVER2吗? -
是的,我可以从 SERVER1 ping 到 SERVER2。
标签: javascript node.js web-development-server