我的jQuery alert()没有显示所谓的内容,包括我的index.php文件

时间:2014-06-02 23:50:11

标签: php jquery ajax

我有一个分页,我只使用php,但现在我试图使用ajax和一些淡入淡出效果进行分页。

我在我的index.php中有这个链接来传递我的BASE,这是我的htttp:// localhost / project url到jQuery:

<link rel="nofollow" title="base" href="<?php echo BASE; ?>" />

然后我点击我的分页链接时,我的jQuery功能有效。

$(function(){
   base = $('link[title="base"]').attr('href');
   urlaction    = base+'/actions'; 
   alert(urlaction);   
$('#body-content').on('click','.paginator a',function(){    

        if($(this).hasClass('active')){
            return false;
        }else{
            $('#body-content .paginator span').css({color:'#FFF','border-color':'#fff'});
            $('#body-content .paginator a').removeClass('active');
            $(this).addClass('atv');

            var url  = $(this).attr('href');
            var data = url.lastIndexOf('/') + 1;
            var data = url.substr(data);

            $('#body-content .news').fadeTo(500,'0.2');

            $.post(urlaction,{action:'article_pagination',page:data},function(pagination){              
                alert(pagination);
                $('html, body').delay(500).animate({scrollTop:$('h2').offset().top},500);
                window.setTimeout(function(){
                        $('#body-content').html(pagination);
                        $('#body-content .news').fadeTo(500,'1');
                },600);
            });         
        }   
        return false;
    });
});

如果我提醒我的alert(urlaction)我收到了我的本地主机/项目/操作,那么它是正确的,它是我的actions.php文件的URL。

但是当我做警告时(分页);我的警报框中的index.php中的所有代码都提醒我,所以似乎没有获得我的actions.php文件的正确路径。但路径是正确的......

你看到这里有什么问题吗?

我的提醒显示如下:

<!DOCTYPE html...>
<html xlmlns>

.... 和我所有的index.php内容

1 个答案:

答案 0 :(得分:0)

我猜你在$之前错过了BASE,并且看到错误页面通过该信息发回给你。