Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox add-on sdk if failing AJAX requests

Please note the following code:

    $.ajax({
     type: "POST",
     url: loginURL,
     data: jsonArray,
     async: true,
     success: function(data, status){
         alert(status);
     },
     error: function(data, status){
         alert(status + " 1");
     }
});

The error case is thrown every time, but I have fiddler open and I'm receiving data from the server just fine. I'm attaching a panel to a widget. In the HTML that gets loaded in the panel, I'm including the latest jquery and a login javascript file.

like image 908
Sean Lindo Avatar asked Dec 04 '25 12:12

Sean Lindo


1 Answers

Actually you can make cross domain request in content script of Firefox extension. check this link:

https://developer.mozilla.org/en-US/Add-ons/SDK/Guides/Content_Scripts/Cross_Domain_Content_Scripts

you need to clarify the domain permission in package.json like this:

"permissions": {
  "cross-domain-content": ["http://datapoint.metoffice.gov.uk"]
}
like image 120
Hank X Avatar answered Dec 06 '25 02:12

Hank X



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!