I have tied everything I can think of but for some reason If I try to load the raw file from gist via ajax or in an iframe with fancybox or something it won't work. It works fine in the browser though. Any ideas?
<a class="raw-file" href="https://gist.github.com/raw/2408789/2da6f8b2377cdb86ac0b7a005eec1c1b90459569/Jquery-click-prevent-redirect.txt">Jquery-click-prevent-redirect.txt</a>
<div>results here...</div>
$(document).ready(function() {
$("a").click(function(event){
jQuery.ajax({
url: $(this).attr('href'),
dataType: "json",
beforeSend: function(){
$(this).closest('div').html('getting file...');
},
success: function(data) {
$(this).closest('div').html(data);
},
complete: function(){
//stuff here
}
});
});
});
full demo here: