我遇到了一些JavaScript代码的问题。当我在本地测试网站时它工作正常,但在服务器上不起作用,除非我重新加载页面。代码如下。如果您需要更多详细信息,请告诉我。Javascript在本地工作,但不在服务器上
$(document).ready(function(){
$("#header_inbox_bar").click(function() {
const inboxtopcount = $('#inboxtopcount')
const badgedanger = inboxtopcount.parent('.badge-danger')
$.ajax({
type: 'POST',
url: 'controllers/ctrl_client_update_inbox_notifications.php',
success (res) {
if (res) {
badgedanger.hide()
inboxtopcount.hide()
}
},
});
});
});
同源策略? – Evgeny
你看到任何错误? – jdave
请向我们显示错误 – sumit