How can I update the DOM with new record added element after call?
Should I return the newly inserted db record contents on call back then append using jquery?
Please advice if not enough data to answer question.
$(function(){
$('#postentry').submit(function() {
var tyu = $('#tittle_ent').val();
if(tyu.length <= 2)
{alert('Enter More Text!'); return false;}else
{
$.post(
"posts_in.php",
$("#postentry").serialize(),
function(data){
//alert(data);
}
);
return false;
}
});
});
Each record look like this:
<div id="post349" class="myclass">
This is some text.
</div>
I’d use
$.ajax()instead of$.post():Quick demo of how the div will be appended and populated: http://jsfiddle.net/AlienWebguy/zuPA2/1/