Web Analytics Made Easy -
StatCounter POST form input on a <li> - CodingForum

Announcement

Collapse
No announcement yet.

POST form input on a <li>

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • POST form input on a <li>

    Allright, so i got index html, and on the head of the document i got jquery already, and what i got is a form, and what i want it to do is that once the input is sumbmited, to post it on a list. BUt something is missing here or maybe im doing it wrong, i need some guidance plz.

    here is my table:
    Code:
    <form name="postbar_add_post" id="postbar_add_post" method="post">
    	<fieldset>
        	<legend>Write text here ...</legend>
            <input type="text" name="addcontentbox" id="addcontentbox"  />
            <input type="button" name="addpost" value="Submit" class="submit" />
    	</fieldset>
    </form>
    and heres is the function that i have on the head, where what i try is to make it post on the list:

    Code:
    <script type="text/javascript">
    $(document).ready(function(){
    $("form#postbar_add_post").submit(function() {
    
    var message_wall = $('#addcontentbox').attr('value');
    
    $.ajax({
    type: "POST",
    data:"addcontentbox="+ addcontentbox,
    success: function(){
    $("ul#wall").prepend("<li>"+addcontentbox+"</li>");
    $("ul#wall li:first").fadeIn();
    }
    });
    return false;
    });
    });
    </script>

    But is just not working :S .... any ideas/guidance? xD .

    Btw, on the body, theres only that table above, and a " <ul id="wall"></ul> " , wich is where im trying the content to be posted on.

    Any ideas where the flaw is ? =\

  • #2
    Well, not to ask a silly question, but...

    Where are you telling AJAX what URL to post the information to???

    I don't see a URL anywhere in there.

    I don't use jQuery, but no matter what it can't post anything without a URL to post to.
    Be yourself. No one else is as qualified.

    Comment


    • #3
      Originally posted by Old Pedant View Post
      Well, not to ask a silly question, but...

      Where are you telling AJAX what URL to post the information to???

      I don't see a URL anywhere in there.

      I don't use jQuery, but no matter what it can't post anything without a URL to post to.
      lol,good question, thanks.

      ....I just have to see now how would i go about putting an url to the list ....

      Comment


      • #4
        You're going to need a database on the server and then some sort of server-side code to handle the AJAX request: PHP or ASP or JSP or ...

        You can add content to "wall" from hitting the submit button, but it will only be on that page for that user, without the server side processing.
        Be yourself. No one else is as qualified.

        Comment


        • #5
          I might use php thenn.

          THANKS !!!! I really needed the guidance xD. Makes more sence now xD.


          If anyone has more suggestions they're welcome =P.

          Comment


          • #6
            Might want to start here:

            W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
            Be yourself. No one else is as qualified.

            Comment


            • #7
              Originally posted by Old Pedant View Post
              hahaha, thanks !!!!! =) .

              Comment

              Working...
              X
              😀
              🥰
              🤢
              😎
              😡
              👍
              👎