![](/img/trans.png)
[英]How to send data from one website to another website in React js?
[英]POST Request from one website to another in JS
我需要從 SERVER1 上運行的應用程序向 SERVER2 上運行的應用程序發出 POST 請求。
服務器1:
<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>
服務器2:
router.post('/download_item', async function(req, res) {
itemid= req.body.item_field;
});
當我在同一服務器 (localhost) 上運行這兩個應用程序但在不同的服務器上不起作用時,此方法有效。
您可以在 npm 中同時運行多個服務器。 對於兩台服務器,需要創建兩個實例,然后只有您可以在兩台服務器之間訪問。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.