I'm new in chrome extension, I'm trying to develop a chrome extension that communicates with my python web API. It throws an error.
These are permissions in manifest.json:
"background": {
"scripts": ["jquery-3.2.1.min.js","backgroundScript.js"],
"persistent": true
},
"permissions": [
"tabs",
"http://*/",
"https://*/",
"webNavigation",
"*://*/*",
"http://127.0.0.1:5000/*"
]
This is ajax request in backgroundScript.js:
let obj = {
"url": response
};
$.ajax({
type: "POST",
url: "http://127.0.0.1:5000/api/scrape_company", // URL de l'API
xhrFields: {
withCredentials: true
},
data: obj,
unique: true,
dataType:'json',
success: function (result) {
if (result=== obj["url"] + ': scrapped and inserted with success') {
alert(result);
} else{
alert('Check your url !');
}
},
error: function () {
alert('Please wait until the scraping is done');
}
});
And this is my popup.html :
...
<script type="text/javascript" src="jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="backgroundScript.js"></script>
<link href="http://127.0.0.1:5000/api/scrape_company">
</head>
How can I communicate with my web server? thanks in advance