处理jsonp错误

I have a code to check Youtube video total time and get the duration using jQuery ajax.

The code doesn't seem to catch the errors. What am I doing wrong?

// get Video Total Time
var youTubeURL = 'http://gdata.youtube.com/feeds/api/videos/'+ video_code +'?v=2&alt=json';

$.ajax({
    'async': false,
    'global': false,
    'url': youTubeURL,
    'dataType': "jsonp",
    crossDomain: true,
    error: function (xhr, testStatus, error) {
        console.log('error: '+'$.ajax() error');
    },
    success: function (data) {
        var duration = data.entry.media$group.yt$duration.seconds;
        console.log('total time: '+duration);
    }                       
});

You do string concatenation properly in the success: function, but have a typo in the error: function.

// get Video Total Time
var youTubeURL = 'http://gdata.youtube.com/feeds/api/videos/'+ video_code +'?v=2&alt=json';

$.ajax({
    'global': false,
    'url': youTubeURL,
    'dataType': "jsonp",
    error: function (xhr, testStatus, error) {
        console.log('error: '+ error);
    },
    success: function (data) {
        var duration = data.entry.media$group.yt$duration.seconds;
        console.log('total time: '+ duration);
    }                       
});