I have the below code in my .aspx page.
<input type="hidden" id="fbinfo" name="fbinfo" value="" runat="server" />
<script src="Scripts/jquery.min.js"></script>
<div id="fb-root"></div>
<script src="Scripts/all.js"></script>
<script>
FB.init({
appId: 'thisIsMyAppId',
status: true,
cookie: true,
xfbml: true
});
FB.getLoginStatus(handleSessionResponse);
function handleSessionResponse(response) {
if (!response.session) {
clearDisplay();
return;
}
FB.api({
method: 'fql.query',
query: 'SELECT uid, first_name, last_name, FROM user WHERE uid=' + FB.getSession().uid
},
function(response) {
var user = response[0];
var userInfo = document.getElementById('fbinfo');
$('#fbinfo').html('user id is:' + user.uid);
}
);
}
When I run it, VS IDE throws back an error message saying
htmlfile: Unexpected call to method or property access.
And this highlighted this part of the code inside the jquery.min.js
{if(this.nodeType==1){this.appendChild(E)}
Question is how to pass a value from the fql queried to a HTML input hidden type control or asp:control (like Label or Hidden field) ?
#fbinfois aninputelement, as such, you cannot sethtml()inside it, but should instead, useval().Like this:
For more information, have a look at the val() documentation.