Controller method and JS implemented for web calculation