Skip to content

Instantly share code, notes, and snippets.

@WenLiangTseng
Created August 20, 2013 14:24
Show Gist options
  • Save WenLiangTseng/6282062 to your computer and use it in GitHub Desktop.
Save WenLiangTseng/6282062 to your computer and use it in GitHub Desktop.
jQuery讀取(重新載入)部分網頁,不用全畫面重新整理
//程式碼
var url = "http://yourdomain.com/yourpage.html";
$("#elementName").load(url+" #elementName>*","");
//應用
$('#button1').click(function() {
var url = "http:www.your-url.com?ID=" + Math.random(); //create random number
setTimeout(function() {
$("#elementName").load(url+" #elementName>*","");
}, 1000); //wait one second to run function
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment