0

I am a noob and I need help in a project. This is the API URL provided by the uClassify site, https://api.uclassify.com/v1/uclassify/sentiment/classify/?readKey=YOUR_READ_API_KEY_HERE&text=This+is+the+text+to+classify

the JSON data is displayed as {"negative":0.0778055,"positive":0.922195}

Can someone please suggest a code in javascript to read the JSON data and store in a variable?

SlazyBlade
  • 53
  • 4
  • 2
    Possible duplicate of [Parse JSON in JavaScript?](http://stackoverflow.com/questions/4935632/parse-json-in-javascript) – Sachin Gupta Sep 14 '16 at 08:21

1 Answers1

0

refer the following:

$("#ddlButton").click(function () {

 $.getJSON("https://api.uclassify.com/v1/uclassify/sentiment/classify/", { readKey: YOUR_READ_API_KEY_HERE,text=This+is+the+text+to+classify},
           function (data) {

               $.each(data, function (Modal, itemData) {


                       document.getElementById("text1").text= itemData.negative,
                       document.getElementById("text2").text= itemData.positive

               });
           });
});
Abhishek Pandey
  • 338
  • 1
  • 3
  • 13