how to use post in “Request” function at firefox-addon-sdk

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 14:27:15

问题


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

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?


回答1:


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();
};


来源:https://stackoverflow.com/questions/7868175/how-to-use-post-in-request-function-at-firefox-addon-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!