ajaxError

        $(document).ready(function ()
        {
            $('input:button').click(function()
            {
                if($('#fileName').val() == '')
                {
                    $('#result').html('<span>Please provide a file name.</span>');
                    return;
                }
                $.ajax({
                url: $('#fileName').val(),
                method: 'get',
                success: function(data)
                {
                        $('#result').html(data);
                }
                error: function()
                {
                    $('#result').html('<span>An error occured.</span>'); 
                 }
                });
            });
            
            $('#result').ajaxError(function()
            {
                $('#result').html('<span>An error occured.</span>');
            })
        });
posted on 2014-04-24 22:39  思静  阅读(188)  评论(0编辑  收藏  举报