I usually work with PHP but i've been working on a widget now that has most of the functionality on the client side.
Basically, it's a simple foursquare plugin for Typo3 where it displays the latest tip for a venue and the option to check in, with shout.
The check in is all done on client side from initial OAuth to the ajax Foursquare API call. I'll stop now and show you the code js snippet. Security is my main concern here btw.
Any feedback greatly appreciate.. Thanks :)
$(document).ready(function(){
$("#checkin").click(function(){
$.oauthpopup({
path: "http://127.0.0.1/typo3/index.php?eID=fs_callback",
callback: function(){
var access_token = $("input#access_token").val();
var venue_id = $("input#venue_id").val();
var shout = $("#shout").val();
var dataString = "oauth_token="+ access_token + "&venueId=" + venue_id + "&shout=" + shout;
$.ajax({
type: "POST",
url: "https://api.foursquare.com/v2/checkins/add",
data: dataString,
success: function(data) {
var msg;
if(data.meta.code === 200) {
msg = "Check In Accepted!";
}
else {
msg = "An Error Occured!";
}
$("#response").html(msg);
},
error : function(data) {
$("#response").html("Something went wrong!");
}
});
return false;
}
});
});
});