<div id="partition">
hello
<input type="button" id="btn" value="submit">
</div> <!-- partitions ends -->
<!-- this posts the data and prepends the return data to partition div -->
<script type="text/javascript">
$(document).ready(function() {
$('#button').click(function(){
var content = $('#content').val();
var contentType = $('input[id=contentType]:checked').val();
$.post('classes/updateStatus.php', { content: content, contentType: contentType }, function(data)
{
$('#partition').prepend($('<div id="partition">'+data+'</div>').html(data));
});
</script>
<script type="text/javascript">
$(document).ready(function() {
$('#btn').click(function(){
alert("hello");
});
</script>
The problem with this script is that after prepending the data to partition div, it doesn’t perform the necessary action. In this case, it doesn’t popup an alert box.
So, you can do something like below:
(this is old version)
or
(this is in new version)
Hope this Helps!!