javascript - Chrome extension xmlhttprequest() not working : succeeds to read, but fails to send information to an external server

I'm writing a chrome extension that is connected to an external php server. There are two main things that my chrome app does regarding the interaction with ther server :
1. read the stored comments from the server and show it on the extension
2. if a user writes a new comment, send it to the server so it can store the comment in the MySQL DB.
The problem I have is that while my extension has no problem fetching information from the server, it constantly fails to send new comments to the server. Since the reading function works, I assume that I have no problem with the CORS or anything.
This is the code I wrote to read the info from the server.
function getUrl() {
chrome.windows.getCurrent(function(w) {
chrome.tabs.getSelected(w.id,
function (response){
link = response.url;
//console.log(link);
hr = new XMLHttpRequest();
var info="link="+link;
//console.log(info);
hr.open("POST", "http://nardis.dothome.co.kr/nardis_core/comment_load.php", true);
hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
hr.onload = () => {
const data = hr.responseText;
//console.log(data);
box.innerHTML += data;
//console.log(data);
};
hr.send(info);
});
});
}
This is the code I wrote to send the information to the server.
function sendPost(){
chrome.windows.getCurrent(function(w) {
chrome.tabs.getSelected(w.id,
function (response){
//const title = document.getElementById('title').value;
const description = document.getElementById('comment').value;
link = response.url;
//console.log(link);
hr = new XMLHttpRequest();
chrome.storage.sync.get(['u_id'], function(result) {
var info="description="+description+"&link="+link+"&u_id="+result.u_id;
hr.open("POST", "https://nardis.dothome.co.kr/nardis_core/mention_create.php", true);
hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
hr.send(info);
location.reload();
});
});
});
}
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: err_ossl_pem_no_start_line
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.