来自node.js服务器的Ajax POST [重复]


                            
            

                

                    

                        

                             此问题已在此处提供答案</ b>:
                            
                         </ div>
                     </ div>
                 </ div>
                        

                             如何在node.js中发出HTTP POST请求?</ 一个>
                                
                                     (21个回答)
                                 </ span>
                         </ div>
                
已关闭 6年前</ span>。</ div>
             </ div>
         </ aside>

我有带有Socket.IO的Node.js服务器,该服务器与Python服务器(Django)通信。

我需要执行从node.js服务器(使用特定方法)到Django服务器的POST。

我无法使用任何jquery函数,因为它需要窗口文档。 </ p>

还有其他想法如何使用POST方法将数据从Node.js发送到Django并检查是否成功?</ p>

谢谢。</ p>
     </ div>

展开原文

原文

This question already has answers here:
                </div>
            </div>
                    <div class="grid--cell mb0 mt4">
                        <a href="/questions/6158933/how-is-an-http-post-request-made-in-node-js" dir="ltr">How is an HTTP POST request made in node.js?</a>
                            <span class="question-originals-answer-count">
                                (21 answers)
                            </span>
                    </div>
            <div class="grid--cell mb0 mt8">Closed <span title="2014-01-28 22:55:12Z" class="relativetime">6 years ago</span>.</div>
        </div>
    </aside>

I have Node.js server with Socket.IO, which communicate with Python server (Django).
I need to perform POST from the node.js server (on specific method) to the Django server.
I cannot use any jquery function because it require window document.

Any other idea how can i send data to the Django from Node.js with POST method and check if it success?

Thanks.

</div>

2个回答


您要查看 HTTP包。 具体使用 ClientRequest 类发出POST请求</ p>
     </ div>

展开原文

原文

You want to look at the HTTP package. Specifically use the ClientRequest class to issue the POST request

展开原文

原文

https://npmjs.org/package/request

request.post('http://service.com/script', {form:{key:'value'}}, function(err,response,body){...});

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐