This example uses the sajax library and does the calculation server-side without needing a page refresh.
For more info see this blog entry