Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 827
Roy Avatar asked Oct 23 '11 18:10

Roy


1 Answers

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();
};
like image 79
Nickolay Avatar answered Sep 17 '22 18:09

Nickolay