function out $('document').ready()
<p>i've got this simple code</p>

<pre><code>$(document).ready(function(){

   $.ajax({
      success: function(id) {
         $('#ele').append('&lt;a href="" onclick="deleteImg(id)"&gt;')
      }
   })

   function deleteImg(id) {
      foo...
   }

}
</code></pre>

<p>but, when i click on the created href, i received this error</p>

<pre><code>deleteImg is not defined
</code></pre>

<p>i have to put the deleteImg function out the $(document).ready() to working it</p>

<p>why?</p>

<p>many thanks!</p>
