AJAX jQuery tab选项卡

vardefault_content="";

$(document).ready(function(){

checkURL();

$('ul li a').click(function(e){

checkURL(this.hash);

});

//filling in the default content

default_content = $('#pageContent').html();

setInterval("checkURL()",250);

});

varlasturl="";

functioncheckURL(hash)

{

if(!hash) hash=window.location.hash;

if(hash != lasturl)

{

lasturl=hash;

// FIX - if we've used the history buttons to return to the homepage,

// fill the pageContent with the default_content

if(hash=="")

$('#pageContent').html(default_content);

else

loadPage(hash);

}

}

function loadPage(url)

{

url=url.replace('#page','');

$('#loading').css('visibility','visible');

$.ajax({

type: "POST",

url: "load_page.php",

data: 'page='+url,

dataType: "html",

success: function(msg){

if(parseInt(msg)!=0)

{

$('#pageContent').html(msg);

$('#loading').css('visibility','hidden');

}

}

});

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • document.write(''); } if ( (document.cookie && document.c...
    一副怂样阅读 3,989评论 0 1
  • 简介 最近在看7.0的一些新特性,记录下小知识方便之后使用。今天要说的就是状态栏通知可直接回复的功能。(一定记得是...
    灿烂的黑土阅读 5,882评论 0 2
  • 我们都知道,一个企业其实就是一个团队,一支分工不同的人组成的队伍。其中有投资人,债权人,管理人,有劳动力。我们会问...
    印第安南阅读 5,289评论 0 0
  • 最近宝贝早上总是粘着我 各方面效能都有点低。 加上双11 总感觉有采购不完的东西, 看来需要复听一下彭彭的精要主义...
    佳茗妈阅读 975评论 0 0
  • 春天来了,万物复苏,草木萌动。就象今天这张塔罗牌“钱币1”上的翠绿,春意黯然,生机勃勃。 家门口那...
    悦子wz阅读 3,421评论 3 5