I am trying to decode the signed request that comes from Facebook. I tried to use the below code using javascript, but I am not sure about the function to use for decoding and then parsing the JSON response. My Response object is signed_request and it contains the user profile information like name, gender, email, etc. I want to do something similar like this page shows in php: (Goto the section which says parsing the signed request) https://developers.facebook.com/docs/facebook-login/using-login-with-games/
<script>
$(document).ready(function () {
var signedRequest = $("h2").html();
var data = signedRequest.split('.')[1];
data = JSON.parse(data);
name = data.name;
console.log(name);
});
</script>
<body>
<form id="form1" runat="server">
<div>
<% string name1 = Request.Params["signed_request"];%>
<h2><%= name1 %></h2>
</div>
</form>
</body>