如何在“请求"中使用 postfirefox-addon-sdk 的功能 [英] how to use post in "Request" function at firefox-addon-sdk

查看:25
本文介绍了如何在“请求"中使用 postfirefox-addon-sdk 的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在此链接中阅读了有关请求"功能的信息:https://addons.mozilla.org/en-US/developers/docs/sdk/1.1/packages/addon-kit/docs/request.html

I read about function 'Request' as this link: https://addons.mozilla.org/en-US/developers/docs/sdk/1.1/packages/addon-kit/docs/request.html

我想使用post"方法.没有关于如何使用 post 方法将变量从 JS 发送到我的服务器的解释或示例.我该怎么做?

And I would like to use the "post" method. There is no explaination or example on how to send a variable from JS to my server with the post method. How can I do it?

推荐答案

您只需使用 post() 更改该页面示例中的 get() 调用.

You just change the get() call in the example on that page with post().

exports.main = function() {
    var Request = require("request").Request;
    Request({
      url: "http://google.com/",
      content: {q: "test"},
      onComplete: function (response) {
        console.log(response.text);
      }
    }).post();
};

这篇关于如何在“请求"中使用 postfirefox-addon-sdk 的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆