Ajax, javascript_tag and JS Var trouble, help nedded.

Hello there,

I have a clients controller, and I want it to respond both ajax and html to the new action.

If the user uses the html action, the new partial is going to be rendered and all works with no problem. In oder hand, if a ajax request is submitted, everything renders ok (it will be rendered inside a div in the index page), but some JS functions don't.

I have this piece of code in my view: