form.php
Code PHP:
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function() {
 
$(".submit").click(function() {
    var mytext = $("#mytext").val();
    var dataString = 'mytext='+ mytext;
	if(mytext=='')
	{
	$('.success').fadeOut(200).hide();
    $('.error').fadeOut(200).show();
	}
	else
	{
	$.ajax({
	type: "POST",
    url: "texter.php",
    data: dataString,
    success: function(){
	$('.success').fadeIn(200).show();
    $('.error').fadeOut(200).hide();	
}
});
}
return false;
});
});
</script>
<input id="mytext" type="text" />
<input  type="submit" class="submit"/>
<span class="error" style="display:none">ERROR FIELD IS EMPTY</span>
<span class="success" style="display:none">DONE</span>
texter.php post
Code PHP:
if(isset($_POST['msg_submit'])) {
	$mytext = quote_smart3(htmlspecialchars($_POST['mytext']));
 
	if ($_POST['mytext'] == '')
				echo 'field is empty';
	else {
	$sql = ..
				echo 'done';
	}
}

i think javascript doesn't do correct post because when i press submit, then it says: DONE but @ mysql mytext didn't added..
hmm how to fix?