0
It’s a Google extension where I copy a text from a page and I copy a JSON with what was copied, but I’m not sure how to do it correctly. I managed to do this part but I’m not sure if I have a JSON.
chrome.contextMenus.onClicked.addListener(function(Clique)){
if(Clique.menuItemId == "Clipenews_paragrafo"){
console.log("Sucesso");
var texto = Clique.selectionText;
$.ajax({
url: 'localhost',
dataType: 'json',
method: 'post'
data:{ data:JSON.stringify(texto)},
});
console.log(texto)
}
What kind of content can this have
Clique.selectionText
? See if this answer helps: How to convert formdata to json?.– Pedro Gaspar
Click.selectionText takes what was selected and copied by the mouse and plays in the var text
– caeira