Binary Lion Studios

I code for fun and for food.

Ajax with Facebook C# SDK

To make an Ajax call from a Facebook Canvas app, you need to pass the signed request along. The Facebook C# SDK does not use cookies for Canvas apps (yay!), so it needs the signed request to establish context. Using Razor, it might look something like this:

1
2
3
4
var url = "@Url.Action("Action", new { signed_request = Request["signed_request"] })";
$.get(url, function(data) {
    $("#contentHolder").html(data);
});