jquery value of textarea

Posted by Elliott on Stack Overflow See other posts from Stack Overflow or by Elliott
Published on 2010-04-21T10:20:35Z Indexed on 2010/04/21 10:23 UTC
Read the original article Hit count: 338

Filed under:
|

Hi, I have the code below, which sends the value of the textarea and either gets a fail or Successful response, for now I just check if it says "hello".

function postdata()
{
    $.ajax({
    type: "POST",
    dataType: "text",
    url: "makepost.php",
    data: "post_text=" + $("#post_text").val(),
    cache: false,
    success: function(reply_text)
    {
        if (reply_text.indexOf("Successful") >= 0)
        {
            alert("Post Made");     

        }
        else 
        {
            alert(reply_text);
        }
    }
    });
}

<textarea rows="3" cols="25" id="post_text" ></textarea><br />
    <input type="submit"  id="post_bttn" value="Post" onclick="postdata(); return false;">

I have also tested just echo'ing out the value of the textarea, and all the time it is jus blank. Although in firebug it shows that I have sent that text.

Any ideas? Thanks :)

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about jQuery