如何在jquery中附加函数后调用它

i am appending a div using ajax and alnog with that div a function (it's a time ago function) the function needs to be called as soon as the div is appended I've tried all possible solutions but none works

my function (located in processor.php page)

 <script>
 $(document).ready(function () {
    $('.post_the_stat').click(function(event) {event.preventDefault();

    $.ajax({
        type: "POST",
        url: "addition_life_text.php",
        data: 'final_text='+ fin_text +'&priv='+ priv + '&post_time='+post_time ,
        success: function(data) {
                 $(".main_container").prepend(data);
                                }

          })
    })
 })
 </script> 

the function

<script>
function ago()
{
  //codeblock
} 
</script>

my question:how do i call the function ago as soon as the ajax was success is appended.ive tried window.onLoad etc...

查看全部
dongzouhe9734
dongzouhe9734
2014/05/02 10:45
  • php
  • html
  • ajax
  • javascript
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

2个回复