Hi guys, I’ve got a problem with a javascript code, it works fine when i test the website locally bot doesn’t work on the server unless i reload the page, this is the code, please let me know if you need more datails
$(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()
}
},
});
});
});
many thanks
vincenzo
Does the browser console show any problems when the page loads?
Hi @Paul_Wilkins thanks for answering no the console doesn’t show any problems
A link to a webpage that exhibits the problem will be most useful for further analysis.
vincekaribusana:
success (res) {
this line should throw an error!
Hi guys thanks for your help, I think I’ve sorted it in this way. Sorry on my phone does’t let me highlight the code
$(document).ready(function() {
$('body').on('click', '#header_inbox_bar', function() {
const inboxtopcount = $('#inboxtopcount');
const badgedanger = inboxtopcount.parent();
$.ajax({
type: 'POST',
url: 'controllers/ctrl_client_update_inbox_notifications.php',
success(res) {
badgedanger.hide();
},
});
});
});
system
Closed
May 2, 2017, 8:45pm
7
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.