How to prevent renderPartial render javascript at each request

I have a index, calling JUiDialog, and use ajax to call another controller action result (HTML), which will show in that dialog

this action result has button with javascript actions, so I use renderPartial in the controller action to generate the HTML

but when User let the Dialog show again and again, this controller action has been request more and more times

then my index got a lot of same javascript code blocks :mellow:

it’s funny, when User click the button in the dialog, the javascript code execute a lot

so they will see 3 times same alert, or even more

how to prevent javascript code pass each request, I just want to have 1 javascript code block at the first time :(

got the problem:

I use live to bind something, but forget use die

people you can try such as ajaxButton, will see the js code, use "delegate" and "undelegate", just like "live" and "die"