Results 1 to 2 of 2

Thread: jquery ajax for live chat

  1. #1
    Join Date
    Mar 2011
    Posts
    2,144
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default jquery ajax for live chat

    Hello everyone,

    EDIT -

    I would like some jQuery code that connects to a page (ajax) {and sends some info}, then returns whatever is echoed and assigns it to the innerHTML of the div with the id usermsg.
    I need it to automatically do this every 2.5 seconds.

    Thanks, Keyboard1333
    Last edited by keyboard; 05-23-2012 at 09:22 AM.

  2. #2
    Join Date
    Mar 2011
    Posts
    2,144
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default

    Ah ha!

    Fixed it -

    Code:
     $(document).ready(function() {
     	 $("#chatBox").load("update.php");
       var refreshId = setInterval(function() {
          $("#chatBox").load('update.php');
       }, 1000);
       $.ajaxSetup({ cache: false });
    });

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •