I'm newbie on sap abap and sap crm and javascript. I'm trying to get facebook's page stream into my bsp app.
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content id = "content"
design = "design2003"
controlRendering = "sap"
rtlAutoSwitch = "true" >
<htmlb:page title="jQuery" >
<htmlb:form id = "formBody"
method = "post" >
<script type="text/javascript" src="jquery-1.7.2.min.js" ></script>
<script>
function getPosts() {
FB.api('/8****5833028****/feed', 'get', { access_token : '7***5058***8**7|qJzB0*****VRC***YfE****wpk4' }, function(normalData) {
if (!normalData || normalData.error) {
alert('Error occured');
} else {
alert(normalData.data[0].from.name);
$('<div class="result"></div>')
.append('<h3>' + normalData.data[0].from.name + '</h3>')
.append('<h3>' + normalData.data[0].message + '</h3>')
.appendTo('body');
document.getElementById("gv_response").value = normalData;
}
});
}
</script>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '7***5058***8**7',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<a href="#" id="postButton" onClick="getPosts()">Facebook</a>
<htmlb:inputField id = "gv_response"
type = "string"
visible = "true"
size = "120" />
<htmlb:button id = "myButton11"
text = "onClick"
onClick = "getPosts" />
<body>
<div class="result"></div>
</body>
</htmlb:form>
</htmlb:page>
</htmlb:content>
With above code, i took all data and i write user name on page from facebook wall's feed. My access_token and connection is right.
Here's my question, how can i pass value into bsp app.'s variable.
- should i parse value in javascript and pass only asked value's?
- or is that possible take all value into bsp's variable and serialize in bsp app?
note: i know there's an abap function can serialize jsons.