input hidden && $.post ?
input hidden && $.post ?
hey guys im trying to make a ajax comment posting but im stuck... have a comment.js:
-
$(document).ready(function()
{
$("#comment_form").submit(function()
{
$("#msgbox").removeClass().addClass('messagebox').text('Checke...').fadeIn(1000);
$.post("modules/comment.php",{
type:$('#type').val(),
comment:$('#comment').val()
} ,function(data)
{
if(data=='yes')
{
$("#msgbox").fadeTo(200,0.1,function()
{
$(this).html('Kommentar gespeichert').addClass('messageboxok').fadeTo(900,1,
function()
{
document.location='news';
});
});
} else {
$("#msgbox").fadeTo(200,0.1,function()
{
$(this).html(data).addClass('messageboxerror').fadeTo(900,1);
});
}
});
return false;
});
});
and this the html part:
-
<form method="post" action="" id="comment_form">
<input type=hidden name="type" value="news">
<textarea id="comment" name="comment" cols="40" rows="20"> </textarea>
<input name="Submit" type="submit" id="submit" value="Absenden" />
<span id="msgbox" style="display:none"></span>
</form>
php:
-
if ($type == "news")
{
blabla
}
if ($type == "user")
{
blabla
}
my problem is the hidden input...
how can i get the value from this?
type:$('#type').val(), <--- now working :/
plz help