Topic: terminate an executing javascript function...

I have to terminate a javascript function prematurally when a new ajax request come in my rails app. How can i do that?