Skip to content

Instantly share code, notes, and snippets.

@sidestepism
Last active December 12, 2015 00:18
Show Gist options
  • Save sidestepism/4682608 to your computer and use it in GitHub Desktop.
Save sidestepism/4682608 to your computer and use it in GitHub Desktop.
どこでも更新
$.fn.extend({
refresh: function(selector, url){
var that = $(this);
$.ajax({
url: url || location.href,
type: 'GET',
success: function(res) {
content = $(res).find(selector || that.selector).html();
$(that).each(function(){
$(this).html(content);
});
},
error: function(){
}
});
}
});
// example
$('.class #id').refresh();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment