ajax不适用于歌剧

My ajax code won't work in opera, however, it works with all other major browsers:

$(function() {  
$("a").on('click', function(e) {
    var href = $(this).attr('href');
    $.ajaxSetup({
        beforeSend:function(xhr) { $('div.imagePlace').animate({height:      '10px'}); },
    });
    $.ajax();
    e.preventDefault();

    setTimeout(function() {
    $.ajax({
        url: href,
        dataType: "html",
        success:function(result) {
            $('.imagePlace').html(result)
            $('.imagePlace').animate({height: '500px'})
        }
    });
        }, 400);
});


    });

Could anyone see what the problem is in opera ? Thanks in advance!

Opera has a debugging tool built in called Dragonfly. Go to the Tools menu -> Advanced ->Opera Dragonfly If you don't have the File menu bar, click Menu -> Page -> Developer Tools -> Open Opera Dragonfly

Once you have it open (open it on the page that you're working on), click the Scripts tab (it'll probably ask you to refresh the page, do that) and drop down to your external js file. Once you've found your code, you can set a breakpoint on the $.ajax() line by clicking on the line number on the left side. Now, trigger your code and you'll see that it will break on that JavaScript line. You can then use the inspection tab (bottom, middle) to ensure that all of your variables are set correctly. You can also step through and debug the JavaScript.

The other thing you'll want to do is add an error function like so:

$(function() {  
$("a").on('click', function(e) {
    var href = $(this).attr('href');
    $.ajaxSetup({
        beforeSend:function(xhr) { $('div.imagePlace').animate({height:      '10px'}); },
    });
    e.preventDefault();
    setTimeout(function() {
    $.ajax({
        url: href,
        dataType: "html",
        success:function(result) {
            $('.imagePlace').html(result)
            $('.imagePlace').animate({height: '500px'})
        }
        error: function(xhr, textStatus, errorThrown) {
        alert(errorThrown);
        }
    });
        }, 400);
});

});

See if that gives you any more information.