How do I generate a JSON file to get variables in Javascript?

0

It's a Google extension in which I copy text from a page and generate a JSON with what it was copied, but I'm not sure how to do it correctly. I was able 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)
}
    
asked by anonymous 23.11.2018 / 23:28

0 answers