As others mentioned It is not possible to stop/abort a function from another as they both are sync process. On the other hand if you want to stop/abort a AJAX (first A stands for Asynchronous) request you can do that with the help of jQuery's AJAX return object. To do that you can follow the following steps;
First create a global variable to handle AJAX object;
var xhr = null;
When you request by AJAX assign the return object to this variable;
xhr = $.ajax(
url: "http://someurl.org",
success: function() { ... }
);
Now when you need to abort request just a xhr.abort()
call should do the trick.
if (xhr != null)
xhr.abort();
Hope that helps;