+ Start a Discussion
sfdc007sfdc007 

JSON Parsing in HTML Page

Hi,

I have a HTML Page where i have a button on it , when i click on the button i am invoking a rest api from my developer account

my issue is , when i click on the button i am just getting the alert message , but when i right click the button and select inspect element i am able to see the output from my rest api

i need to parse and show it as a output on a button click in my html page for which i need help on it

Kindly help me pls
 
MY HTML CODE :

<!DOCTYPE html>
<html>
   <head> 
     <script type="text/javascript" src="jquery-2.1.4.min.js"></script>

     <script>
      function getTasks() {


       $.getJSON("https://bharathnrest-developer-edition.ap2.force.com/services/apexrest/opportunity",
          function(data){
            alert("Data Loaded: " + data);
// $("#content").val(data);
         });
    }
	function jsonpCallback(data){
	alert(data);
}
    </script>
   </head>
   <body>
     <center> <button onclick="javascript:getTasks();">REST API </button></center>
   </body>
</html>
 
my output :

AccountId	"00128000005yLY7AAM"

attributes	[object]
Id	"00628000004KwQ0AAK"
Name	"data-"


Help me how to parse this info in html page

Thanks in Advance