I'm making a Chrome extension that makes a POST call to the website in the current tab. This is to a website behind a login (specifically Shopify). The call works fine when made in the Chrome console, but when made from the background.js of extension I get a 303 redirect and then a 400. The call broadly follows this model:
$.ajax({
type: "POST",
url: 'https://.../apply_changes.json',
contentType: 'application/json',
headers: {
'Accept': "application/json, text/javascript, */*; q=0.01",
}
data: JSON.stringify({"key":"value",...}),
success: function(data){
alert(data);
},
failure: function(errMsg) {
alert(errMsg);
}
});
Is there a way to make this call work in the extension as it does in console? Any help is appreciated!