2013-05-08 92 views
0

我使用AJAX加载页面时出现问题。我创建了一个使用jquery的pinterest类型安排。当我使用AJAX加载内容时,JQuery dosn't工作

但是,当我使用Ajax加载它不起作用。

我已经查找过它并发现bind()函数,但是如何在jQuery中使用它.css。搜索后发现的结果并不令人满意。请帮助

+0

尝试你的函数调用函数你调用Ajax页面Ajax请求 – Shin 2013-05-08 05:33:02

+0

已经尝试过之后 – user2360906 2013-05-08 05:35:06

+0

我可以使用绑定的jQuery功能?请帮助 – user2360906 2013-05-08 05:37:12

回答

1

请更改像

function indmoreclik(a,b) 
    { 
    if (window.XMLHttpRequest) 
    {// code for IE7+, Firefox, Chrome, Opera, Safari 
    xmlhttp=new XMLHttpRequest(); 
    } 
    else 
    {// code for IE6, IE5 
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
xmlhttp.onreadystatechange=function() 
{ 
if (xmlhttp.readyState==4 && xmlhttp.status==200) 
{ 
    document.getElementById("more").innerHTML=xmlhttp.responseText; 

    var t1=0; 
    var t2=0; 
    var t3=0; 

    for(j=1;j<=20;j++) 
{ 
    $('.div1:nth-child('+j+')').css({ top:''+t1+'px',left:'250px'}); 
    height=$('.div1:nth-child('+j+')').outerHeight(true); 
    t1=t1+height; 
    $('.div2:nth-child('+j+')').css({ top:''+t2+'px',left:'520px'}); 
    height=$('.div2:nth-child('+j+')').outerHeight(true); 
    t2=t2+height; 
$('.div3:nth-child('+j+')').css({ top:''+t3+'px',left:'790px'}); 
height=$('.div3:nth-child('+j+')').outerHeight(true); 
t3=t3+height; 

    } 
} 
    xmlhttp.open("GET","tap2.php?tun="+a+"&inc="+b,true); 
    xmlhttp.send(); 

}

+0

在ajax请求完成之后调用您正在使用的文档在文档中准备就绪 – Shin 2013-05-08 05:47:07