Javascript ajax调用未捕获的引用错误

时间:2012-12-22 17:15:39

标签: php javascript ajax elastic-beanstalk

嗨我有一个php应用程序,但我的javascript导致错误,它在localhost上完美运行但是当我上传到amazon elasticbeanstalk它显示我这个错误Uncaught ReferenceError: getEvent is not defined这是我的代码:

index.phtml

<script type="text/javascript" src="../public/js/page/home.js"></script>
$(document).ready(function(){
getEvent();
});

home.js

function getEvent()
{
    var count=1;
    $.ajax({
        url:baseUrl + "event/popularevent",
        data:{'count':count},
        dataType:"json",
        type:"POST",
        async:false,
        success:function(data){
            var eventHtml = '';
            eventHtml = '<li class="clearfix media-block module-li">' +
                    '<div class="media-avatar-passport">' +
                        '<div class="photo-box pb-60s">' +
        '<a class="event-photo" href="/events/san-francisco-halloween-beer-olympics-halloween-drinking-games-1-beer-free">' +
            '<img class="photo-img" alt="Photo of HALLOWEEN BEER OLYMPICS! Halloween Drinking Games + $1 Beer!  FREE!" height="60" src="#" width="60"></a></div>' +

        '</div><div class="media-story">' +
                '<div class="item-title clearfix">' +
        '<a href="/events/san-francisco-halloween-beer-olympics-halloween-drinking-games-1-beer-free" class="url summary">HALLOWEEN BEER OLYMPICS! Halloween Drinking Games + $1 Beer! &nbsp;FREE!</a></div>'+

        '<div class="item-description">'+
        '<span class="extra">'+
        '   Tomorrow, Oct 26, 8:30 pm'+
        '</span><p class="fine-print">140 are interested</p></div>'+
        '</div></li>';
            //alert('ok');
            $('#popular-events .module-list').html(eventHtml);
        }
    });
}

我犯了错误,它运行的问题在localhost上没有错误而不在部署服务器上。谢谢

1 个答案:

答案 0 :(得分:0)

在没有看到环境的情况下很难分辨,但我猜两种情况之一正在发生。

home.js上传到错误的位置或其文件权限设置不正确