I'm running a long polling ajax that returns status of request. If failed, I need the ajax to stop. The ajax is written like this:

```
function someFunction(url){
    $.ajax({
        url: url,
        success: function(data){
            if(data.status == 'FAILED'){
                //Need this ajax to stop
            }
        }
    });
}

$('some-button').on('click',function(
    var url = 'server-url';
    someFunction(url);
));

```

I have to use the `someFunction()` function as this long polling method is being used by multiple other parts of the code. What should I be doing to stop this function?