> For the complete documentation index, see [llms.txt](https://devs.gitbook.io/0/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devs.gitbook.io/0/xu-ly-callback-function-khi-server-deo-bat-cors.md).

# 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' })
                }
            }
        });
```
