Not work my ajax call in function myalert()
<p>I not know why not my ajax call on my function, did you can help me?</p>

<p>Example: <a href="http://jsfiddle.net/MaGyp/7/" rel="nofollow">http://jsfiddle.net/MaGyp/7/</a></p>

<pre><code>function myalert() {
    var result = true;
        //var hide = $('.alert').fadeOut(100);
        //var css = $('#appriseOverlay').css('display','none');
        var $alertDiv = $('&lt;div class="alert"&gt;Do you want to delete this item?&lt;button class="ok"&gt;ok&lt;/button&gt;&lt;button class="cancel"&gt;cancel&lt;/button&gt;&lt;/div&gt;');
        $('body').append($alertDiv);
        $('.ok').click(function () {
            $('.alert').fadeOut(100);
            $('#appriseOverlay').css('display','none');
            callback(true);
        });
        $('.cancel').click(function () {
            $('.alert').fadeOut(100);
            $('#appriseOverlay').css('display','none');
            callback(false);
        });
        $alertDiv.fadeIn(100);
        $('#appriseOverlay').css('display','block');
    return result;
    };

$('.iu').click(myalert)
function callback(result) {
    //
    if(result){
        alert(result);
        $('.image_upbg').each(function(){$(this).removeClass().addClass(unique())});
        var get_class = '.'+$(this).closest('div').attr('class');
        var get_val = $(this).closest('a').find('input').attr('value');
        //alert(get_val);
        var val = 'val_upimg1=' + get_val;
        $(get_class).fadeOut('slow');
          $.ajax({
                type: "POST",
                dataType: 'json',
                url: 'delete_upimg',
                data: val,
                cache: false,
                success: function (data) {
                        $(get_class).fadeOut('slow');
                },
                "error": function (x, y, z) {
                    // callback to run if an error occurs
                    alert("An error has occured:\n" + x + "\n" + y + "\n" + z);
                }
       });
    }else{
        alert('no')
    }
}
</code></pre>
