ie8中的jQuery window.execScript失败

时间:2014-06-26 12:10:44

标签: jquery internet-explorer-8

我正在使用jQuery 1.11.1。在我的页面上我有这个功能:

function loadData() {

    $.ajax({
        url: "",
        async: true,
        method: 'post',
        dataType: "json",
        data: {
            start: $('input[name=start]').val(),
            stop: $('input[name=end]').val(),
            week: $('#weekpicker').val(),
            range:$('select[name=date_control]').val(),
            type: 'loaddata'
        },
        beforeSend: function(xhr, opts) {
            if (!$('input[name=start]').val() && !$('input[name=end]').val()) {
                bootbox.alert('Select date first!');
                xhr.abort();
                return false;
            }

        },
        success: function(dane) {
            ustawienia = dane.ustawienia;

            // some code here

        },
        error: function(dane) {
            $('button[name=pokaz]').removeAttr('disabled');
            bootbox.alert(dane.responseText);
        }
    });
}

它在IE> 8,FF,Chrome上完美运行但在IE8上失败了... enter image description here

// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
    if ( data && jQuery.trim( data ) ) {
        // We use execScript on Internet Explorer
        // We use an anonymous function so that context is window
        // rather than jQuery in Firefox
        ( window.execScript || function( data ) {
            var window[ "eval" ].call( window, data );
        } )( data );
    }
}

我如何修复它以便与IE8一起使用...

0 个答案:

没有答案