Skip to content

Instantly share code, notes, and snippets.

@nhindman
Created April 10, 2014 15:31
Show Gist options
  • Save nhindman/10394335 to your computer and use it in GitHub Desktop.
Save nhindman/10394335 to your computer and use it in GitHub Desktop.
$("#splash-container").on('click','a.twitter-handle-link',function(){
//do something here.
var $div = $("#twitter-info-modal");
if($div.length < 1){
//if it does not exist on the page.
$("#simple-modal-wrap").append('<div id="twitter-info-modal" class="simple-modal"><div class="loader loading"><div class="nu-loader med"></div></div></div>');
$("#twitter-info-modal").fireSimpleModal();
} else {
//if it does not exist.
$("#twitter-info-modal").html('<div class="loader loading"><div class="nu-loader med"></div></div>').fireSimpleModal();
}
//now get the data.
$.ajax({
url: "nate.com/getmydata",
dataType:'jsonp',
type:'post',
success:function(response){
var rows = '';
for(var i in response){
rows += '<div class="card"><div class="title"><a href="'+response[i]['title_href']+'">'+response[i]['title']+'</a></div>'+
'<div class="description">'+response[i]['description_text']+'</div>'+
'<div>other data here</div>';
}
$("#twitter-info-modal").empty().html(rows);
}
});
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment