How do I stop the function which is being executed
===

I have a call to a function on my webpage.
This function does some calculations and it might take couple of hours for it to complete. While function is working, the page is showing nothing and just hangs in 'loading' phase.
I noticed that if I close the browser, the function is stil working. How can I end the process?

    String query ="some query";
    Scanner.Program eb = new Scanner.Program();
    eb.getEbay_com_API(query);