嗨,我有一个 php 应用程序,但是我的 javascript 导致错误,它在 localhost 上完美运行,但是当我上传到亚马逊 elasticbeanstalk 时,它显示这个错误Uncaught ReferenceError: getEvent is not defined
这是我的代码:
索引.phtml
<script type="text/javascript" src="../public/js/page/home.js"></script>
$(document).ready(function(){
getEvent();
});
主页.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! 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);
}
});
}
在我犯了错误的地方,它在本地主机上而不是在部署服务器上运行没有错误。谢谢