Xử lý callback function khi server đéo bật CORS

Xem ở đây: https://www.sencha.com/forum/showthread.php?299915-How-to-make-an-ajax-request-cross-origin-CORS

Đoạn code đấy ở đây:

$.ajax({
            url: 'http:ww.abc.com?callback=?',
            dataType: 'JSONP',
            jsonpCallback: 'callbackFnc',
            type: 'GET',
            async: false,
            crossDomain: true,
            success: function () { },
            failure: function () { },
            complete: function (data) {
                if (data.readyState == '4' && data.status == '200') {
                    errorLog.push({ IP: Host, Status: 'SUCCESS' })
                }
                else {
                    errorLog.push({ IP: Host, Status: 'FAIL' })
                }
            }
        });

Last updated