Working On A Simple Chat Utility Get data from Form without refreshing page

Discussion in 'JavaScript' started by ATTECH, Jul 31, 2010.

  1. #1
    Hello,
    I was working on a simple chat utility and i am completely stuck.
    The only solution which i think can complete this chat is if i can get data of a form without refreshing the whole page somewhat like what facebook does i assume..

    So any suggestions?
    Also any suggestions if youll have for a basic chat utility, i already found one which had way too much complexity and used frames and stuff but it went totally over my head in terms of making better use of it.. i feel it can be done using easier methods..


    So if anyone can help me how to get Input From Form Without Refreshing The Form It would be great? or any other suggestions are fine too.
     
    ATTECH, Jul 31, 2010 IP
  2. ATTECH

    ATTECH Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Okay, basically i want to get input whatever string is entered in it when the submit button is pressed.

    <form name="input" method="post" action="<?php echo $PHP_SELF;?>">
    Message:<input id="text" size="12" maxlength="12" name="message">
    <br />
    <button name="submit">Submit</button>
    </form>
     
    ATTECH, Jul 31, 2010 IP
  3. unigogo

    unigogo Peon

    Messages:
    286
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I never worked on a chat system. But I suggest you at least consider 2 aspects.

    1. Use ajax technique to refresh the data. Here's a simple js object for ajax without using any framework.
    2. Even you don't input anything, the data should be able to refreshed in some interval like gmail. Use setTimeout to do this.
     
    unigogo, Jul 31, 2010 IP
  4. ATTECH

    ATTECH Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Okay i tried using ajax earlier too..

    But Basically like each and every Chat works User but the problem is that to get data from the form input field the page has to be submitted and hence ajax does not work..
    Can you show me an example of getting data from a field without refreshing the page or using ajax?
     
    ATTECH, Aug 1, 2010 IP