May 17, 2008

How Can I Make An Auto-updating Shoutbox Type Script? - I have a few ideas involving AJAX but im looking for something more..

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > Others

free web hosting

How Can I Make An Auto-updating Shoutbox Type Script? - I have a few ideas involving AJAX but im looking for something more..

shadowx
Hi all.

Ive just started to experiment with AJAX working with PHP and MYSQL to get data and display it and im looking to implement it into a shoutbox similar to the one here on the forums but i have a question...

i know how to use ajax and JS to refresh the contents of a DIV every few seconds r so and that essentially reloads the shoutbox content as the REFRESH button does up there ^^ on the shoutbox but i think it silly that it should update every few seconds even if theres no new activity so what im looking for is a way of letting my AJAX know when there is a new entry in the DB and then reloading the DIV to show it as a shout.

One way i just thought of is to use PHP to detect if a new entry has been made, if it has then i will echo out a variable containing the complete entry and if nothing has happened then i can echo out a variable that basically says "no" and have my AJAX detect that and not change the DIV. the downside is with all this AJAX loading the php file every few seconds server load wouldnt be good and it also has a habit of slowing down the browser and lagging it every now and then, this leads me to the next question..

Is there a way to notify my AJAX via php and SQL of a new entry in the database without loading the php page, so instead of AJAX contacting the PHP it works the other way around?

 

 

 


Reply

truefusion
In order to have the PHP script run, it has to be first called, of course. And in order for the AJAX to pick it up, it would have to be running at some kind of interval (of which the PHP script would be runned via cronjobs, whether or not there are visitors) to check the PHP script. This would not only put (extra) load on the server, it would also put load on the browser (however little it may be) of the user. On the version of my shoutbox that i'm working on (it has AJAX), i don't have it refresh at certain intervals, i just let the user click the "Refresh" link if they want to; the shoutbox will reload if they refresh the page or move to another page on my site. So i don't think what you want is possible: having PHP contact AJAX; for in the end it'll just be AJAX contacting PHP anyways and not the other way around.

Reply

shadowx
QUOTE
In order to have the PHP script run, it has to be first called, of course.


True, i didnt think of that...

I was wondering how the T17 shoutbox works, is that interval based? Eg a user shouts a message and so many seconds later it is updated?

Reply

truefusion
QUOTE(shadowx @ Aug 23 2007, 01:29 PM) *
I was wondering how the T17 shoutbox works, is that interval based? Eg a user shouts a message and so many seconds later it is updated?

The way i've seen it work is it refreshes at an interval and it refreshes after the user submits a shout; the interval and shout times don't affect each other.

Reply

shadowx
Fair enough! It seemed to me as though it only updated as a shout was made but of course that was probably just because a user shouted before the update. Ah well i shall use my interval option then!

thanks

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : make, auto, updating, shoutbox, type, script, ideas, involving, ajax, im,

  1. Download Script
    (4)
  2. Streaming Video Capture On Linux
    this script will download all the stream video using linux mplayer (2)
    i was looking for video capter on linux and i coldent find one so i rote one of my one if you use
    linux then you can try this script and if you need any hep just ask CODE #!/bin/bash
    #       # mplayer auto dump stream script #this script will download all the stream files in the
    ./zam_list files #this script by (mohammed tawfeek) zamaliphe@gmail.com #i have do this to
    be able to watch the video on Linux #if you think it is illegally or some thing just  don't tel
    me that ha #© #bash 6/6/2006 download_folder="./video/" #grep -e HREF ./as....
  3. Php - Ajax: E-mail Protection, Clickable Image
    (2)
    Description Concept sparked by the following topic: Email Address Protection From Spam Bots
    . The idea is to have an image, when clicked on, turn into selectable text. The e-mail is encoded,
    and that encoding is sent to the server through AJAX to be decoded via PHP. After it is decoded, it
    gets sent back to be inserted into a text field which is automatically selected upon clicking the
    image. I have decided to keep things limited to one page for now, where the concept can be easily
    seen. Code $get = $_GET ; if ($get != ""){ echo "....
  4. Lightbox Script Variations
    (0)
    When the Web 2.0 and Ajax era kicked the best of the best in programmers started creating scripts of
    various kinds. One of these scripts called Lightbox has one of the biggest impact I have notice, it
    is well customizable to fit various formats, such as images, videos, and even maps. To start off I
    will post a link to the original source of the script, I think. Lightbox The object of this
    script is simple, when a user clicks on a thumbnail version of an image it does smooth transition of
    a pop up image that is larger, usually the original size, and when the user cl....
  5. Ajax - A New Technology
    AJAX relies on Java Script (10)
    Recently i did one of my project using AJAX and i could experience the real advantage of this
    Language , What do you say about that ?....
  6. Looking For Phpbb Script
    (2)
    Hi Friends, I am new to this phpbb script, I come across some features in some site... In some
    sites, the user should reply to the post to view the hidden content. ... Where can I find this kind
    of scripts or plug-ins... Please reply me in this thread.......
  7. I Am Looking For Ideas For A Mirc Addon
    I want your ideas (0)
    Well im currently between 2 projects that im scripting and im bored with them haha!! Just
    looking for ideas for something else i can make... Maybe just sumthing little that u want made, i
    will make it for you and release it here. I have a fairly wide range of scripting knowledge and i
    will try to make most things... Always looking to learn more things also Ta....
  8. Ruby On Rails, Ajax, Scriptaculous, Etc.
    (2)
    Since Web 2.0 has become one of the top buzzwords nowadays, I'm curious about the new languages:
    Ruby (on Rails), AJAX and scriptaculous are several methods programmers use to make web
    applications. I'd like to build some applications, but the trouble is where to start. How easy
    is it to make a web app in the first place? Which programs/languages have a learning curve
    that's not so steep? ....
  9. Swf Cd Help Needed Please
    Need assistance with a next/previous page script (1)
    Question is: I have a web page that displays a flash file that zooms and pans, but the next page
    button doesnt work. 1. Can the next page work and load the next or previous numbered file? 2. Does
    it have to have all pages in one file, then it calls the next frame? I can e-mail you the 3
    pages/files directly, firewall wont let me pload them. Thank you....
  10. How To Auto Stretch An Iframe?
    (2)
    Hello, I have this website I'm working on which has an iframe were all the links in my menus
    etc go to. All of that content I'v put in a table. The iframe itself (on my index page) is in a
    table to. But not every page I linked in the iframe is the same height. So would like to know if
    there is a solution that works to actually let the iframe automatically be resized to the page that
    loads in it. I just want the iframe on my index.html page to stretch automatically, so that I dont
    have to change the widths and all that stuff if I updated my pages, that load in t....
  11. How Do I Script A Tutorial Submit Site
    (3)
    I am very interested in learning how to create or start my own tutorial submitt site. What do I
    need to learn ? What do I need to have. Is there a script that can be made up or a software? What
    I would like to do is start my own tutorial submit site. something similar to good-tutorials and or
    pixel2life except those sites are really big and cover many tutoriasl for many different programs.
    Id like to just cover tutorials for maybe a total of 3 to 4 different programs. Im sure I need
    hosting a domain a site and some good forums to get something good going. But t....
  12. Error In Purchased Script
    Help Me? (9)
    Ok well i bought a script off the net and tried uploading it to my server and it gave me this error
    Fatal error: Unable to read 22293 bytes in /home/ancient/public_html/index.php on line 0 so i
    contacted the guy who made the script and he said there was nothing wrong with the script and gave
    me a ftp to his account and told me to upload the it there and it works on there so i tried another
    script from another guy and i get same error you guys know anything about it???? Moving from
    Computinghost > Technical Support to Programming. Edited topic title--"Help with a scr....
  13. Need Script Please
    need script (4)
    Hey everyone i need a script for a password protected page but not just that i also want and
    registration form with it can n e help....
  14. What Is A News Script?
    Fusion News? Cute News? (1)
    What do news scripts such as Fusion News and Cute News do? Does it provide local news or global
    news or something? Or is it something else?....

    1. Looking for make, auto, updating, shoutbox, type, script, ideas, involving, ajax, im,

Searching Video's for make, auto, updating, shoutbox, type, script, ideas, involving, ajax, im,
advertisement



How Can I Make An Auto-updating Shoutbox Type Script? - I have a few ideas involving AJAX but im looking for something more..



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE