Skip to content

Instantly share code, notes, and snippets.

@jonsgreen
Created December 18, 2013 02:19
Show Gist options
  • Save jonsgreen/8016317 to your computer and use it in GitHub Desktop.
Save jonsgreen/8016317 to your computer and use it in GitHub Desktop.
fetch the sharing div
/*
fetch
fetch the sharing div
*/
fetch: function(element) {
if (sharing.debug) { $.d('Fetch'); $.d(element); }
var sharingDiv = $(element).siblings('.sharing').show();
var id = $(element).attr('data-id');
var type = $(element).attr('data-type');
if (sharing.send_data) {
// Make the request
$.ajax({
url: '/sharing/'+type+'/'+id,
dataType: 'html',
type: 'GET'
})
// When the request is finished
.always(function(data){
sharingDiv.html(data);
twttr.widgets.load();
FB.XFBML.parse(sharingDiv[0]);
sharingDiv.find('.close').click(function(){
if (sharing.debug) { $.d('CLICK Close'); }
sharingDiv.hide();
});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment