Last active
December 12, 2015 00:18
-
-
Save sidestepism/4682608 to your computer and use it in GitHub Desktop.
どこでも更新
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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