In alert I am getting [object object], I need to get names of all sub sites.
<script>
ExecuteOrDelayUntilScriptLoaded(RetriveSites,"sp.js");
function RetriveSites()
{
$.ajax({
url: "https://hp.sharepoint.com/teams/VeraxRep/_api/web/webs",
type: "GET",
headers: {
"accept": "application/json;odata=verbose",
},
success: function (data) {
alert(data.d.results); // This gets alert of [object object]
var jsonObject = JSON.parse(data.body);
var results = jsonObject.d.results;
alert(results);
},
error: function (error) {
alert(JSON.stringify(error));
}
});
}
</script>