Αναζήτηση στην υποστήριξη

Προσοχή στις απάτες! Δεν θα σας ζητήσουμε ποτέ να καλέσετε ή να στείλετε μήνυμα σε κάποιον αριθμό τηλεφώνου ή να μοιραστείτε προσωπικά δεδομένα. Αναφέρετε τυχόν ύποπτη δραστηριότητα μέσω της επιλογής «Αναφορά κατάχρησης».

Learn More

Add-on builder

  • 4 απαντήσεις
  • 2 έχουν αυτό το πρόβλημα
  • 14 προβολές
  • Τελευταία απάντηση από cor-el

more options

Hi,

I am creating firefox extension for corporate use using addon-builder. In that, I shall be creating api request in post method. But when I do this, i get nothing in response. It is working fine with my chrome extension.

Below code I wrote:

var Request = require("request").Request;
    var params = "val=" + value;
    var checkAuth = Request({
        url: "http://myApiName.aspx",
        overrideMimeType: "text/plain; charset=latin1",
        onComplete: function(response){
            alert(response.text);
        }
        }).post(params);

Please let me know where am I going wrong. Am I missing required Library sdks?

Regards,
Darshan Jadhav
Product Engineer,
Deltecs Infotech Pvt Ltd, India

Hi, I am creating firefox extension for corporate use using addon-builder. In that, I shall be creating api request in post method. But when I do this, i get nothing in response. It is working fine with my chrome extension. Below code I wrote: <pre><nowiki>var Request = require("request").Request; var params = "val=" + value; var checkAuth = Request({ url: "http://myApiName.aspx", overrideMimeType: "text/plain; charset=latin1", onComplete: function(response){ alert(response.text); } }).post(params);</nowiki></pre> Please let me know where am I going wrong. Am I missing required Library sdks? Regards,<br /> Darshan Jadhav<br /> Product Engineer,<br /> Deltecs Infotech Pvt Ltd, India

Τροποποιήθηκε στις από το χρήστη cor-el

Όλες οι απαντήσεις (4)

more options

The require looks a bit different in the example here: request - Add-on SDK Documentation.

A comment on a StackOverflow thread suggests using the content property of the request object to pass the parameters (not passing them in the post() function), but I haven't seen a fully fleshed out example.

more options

Hi jscher2000,

Thanks for your reply, well i tried to send post values in content property of request. But now it gave below error: 'require is not defined'

I wrote the above code in separate .js file which is referenced in main.js

more options

I'm sure there is a way to include files in the Add-on Builder, but I couldn't tell you what it is. Hopefully there is a support site for it. This site focuses on Firefox.

more options