The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Ajax script seems not to work anymore

2 posters

Go down

Solved Ajax script seems not to work anymore

Post by Mati November 11th 2014, 20:21

I use this ajax script to count the new PM's but it seems not working anymore I have a custom navbar, was working fine one PunBB before I switched to phpBB3.    

Code:
$.ajax({
  url: '/privmsg?folder=inbox',
  success: function(ajax) {
    count = $('img[src="http://i78.servimg.com/u/f78/14/73/12/96/bf_new10.png"]', ajax).length;
 
    if (count < 1) {
      $('a.mailbox').html('<span>Mailbox</span>');
    }

    else {
      $('a.mailbox').html('<span>Mailbox ('+count+')</span>');
    }
  }
});

Any idea on how to fix this...


Last edited by Mati™ on November 12th 2014, 09:22; edited 1 time in total
Mati
Mati
Hyperactive

Posts : 2020
Reputation : 330
Language : HTML, CSS & JavaScript
Location : Forum Services

https://forumservice.forumotion.com/

Back to top Go down

Solved Re: Ajax script seems not to work anymore

Post by Ange Tuteur November 12th 2014, 02:28

Hello Mati,

Are you using this image for new messages ?
https://i.servimg.com/u/f78/14/73/12/96/bf_new10.png
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Ajax script seems not to work anymore

Post by Mati November 12th 2014, 02:30

Yeah that's the "Subject - New" icon from the Icons for topics.
Mati
Mati
Hyperactive

Posts : 2020
Reputation : 330
Language : HTML, CSS & JavaScript
Location : Forum Services

https://forumservice.forumotion.com/

Back to top Go down

Solved Re: Ajax script seems not to work anymore

Post by Ange Tuteur November 12th 2014, 02:35

Try this :
Code:
$.ajax({
  url: '/privmsg?folder=inbox',
  success: function(ajax) {
    count = $('dl[style*="http://i78.servimg.com/u/f78/14/73/12/96/bf_new10.png"]', ajax).length;
 
    if (count < 1) {
      $('a.mailbox').html('<span>Mailbox</span>');
    }

    else {
      $('a.mailbox').html('<span>Mailbox ('+count+')</span>');
    }
  }
});
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Ajax script seems not to work anymore

Post by Mati November 12th 2014, 09:21

Perfect thanks a lot Ange! Very Happy
Mati
Mati
Hyperactive

Posts : 2020
Reputation : 330
Language : HTML, CSS & JavaScript
Location : Forum Services

https://forumservice.forumotion.com/

Back to top Go down

Solved Re: Ajax script seems not to work anymore

Post by Ange Tuteur November 12th 2014, 10:19

You're welcome Very Happy

Topic archived
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum