top



Like the title i want to ask little about "New Messages" with ajax.

as has been told before, the code to make the notification "You have 1 Messages" is this:

Code:
<script>
$.ajax({
  url: '/privmsg?folder=inbox',
  success: function(ajax) {
    count = $('img[src="http://illiweb.com/fa/punbb/status_unread.png"]', ajax).length;
 
    if (count < 1) {
      $('a.mailbox[href="/privmsg?folder=inbox"]').html('Messages');
    }

    else {
      $('a.mailbox[href="/privmsg?folder=inbox"]').html('Messages ('+count+')');
    }
  }
</script>

But why, notification is not working? There may be some mistakes, I'm sorry because I am not (not) understand about ajax, hehehehe Happy
thanks before !

If you are hosting it on a HTML page you don't need the script tags, also you will need to add:

Code:
   $(document).ready(function() {
      
   });

RockerMan wrote:If you are hosting it on a HTML page you don't need the script tags, also you will need to add:

Code:
   $(document).ready(function() {
      
   });
I put that code in overall_header its that right? or we must hosting it to the page ?
and btw i add that code and this is the code
Code:
$.ajax({
  url: '/privmsg?folder=inbox',
  success: function(ajax)
 $(document).ready(function() {
     
  {
    count = $('img[src="http://illiweb.com/fa/punbb/status_unread.png"]', ajax).length;
 
    if (count < 1) {
      $('a.mailbox[href="/privmsg?folder=inbox"]').html('Messages');
    }

    else {
      $('a.mailbox[href="/privmsg?folder=inbox"]').html('Messages ('+count+')');
    }
  }
});
this is right? Happy

It's easier to host it into a HTML page and just add the link Smile

Code:
  $(document).ready(function() {
      $.ajax({
  url: '/privmsg?folder=inbox',
  success: function(ajax) {
    count = $('img[src="http://illiweb.com/fa/punbb/status_unread.png"]', ajax).length;
 
    if (count < 1) {
      $('a.mailbox[href="/privmsg?folder=inbox"]').html('Messages');
    }

    else {
      $('a.mailbox[href="/privmsg?folder=inbox"]').html('Messages ('+count+')');
    }
  }
  });

okay boss, i created a html pages, but, the link its like this ? hehehehehe Happy

Code:
<script type="text/ajax" src="/h4-"></script>

Code:
<script type="text/javascript" src="/h4-"></script>

Okay Thanks, but the new messages still not working.. Crying

Did you changed the new icon with your "http://illiweb.com/fa/punbb/status_unread.png"

you mean in this?

Code:
count = $('img[src="http://illiweb.com/fa/punbb/status_unread.png"]', ajax).length;
that image is not visible until now Crying

Yes. just the icon="http://illiweb.com/fa/punbb/status_unread.png"

yes i know, maybe i can make you an admin in my forum. its not work until now.

Send your founder info for the one you trust Smile

okay, i send you a pm, maybe you want to help me Happy

Only the founder can access the templates.

Ezio was the founder and are we need chance the "$" to "jQuery"??

No.. it doesn't matter if you put the jQuery in the templates..
he sent me an admin info for helping him...

hi can you help me too? please.... Smile

sorry