# How do I call a Javascript function post-AJAX form submit?

**URL:** <https://www.ruby-forum.com/t/how-do-i-call-a-javascript-function-post-ajax-form-submit/182324>\
**Category:** Rails\
**Created:** [January 26, 2010, 4:50pm UTC](https://www.ruby-forum.com/t/how-do-i-call-a-javascript-function-post-ajax-form-submit/182324 "2010-01-26T16:50:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ressister](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/258eb7/32.png) [@ressister](https://www.ruby-forum.com/u/ressister)\
**Post date:** [January 26, 2010, 4:50pm UTC](https://www.ruby-forum.com/t/how-do-i-call-a-javascript-function-post-ajax-form-submit/182324/1 "2010-01-26T16:50:21Z")

</div>

Here’s my simple problem. I can’t call a javascript function that’s  
included in a page after an AJAX post. I think I’ve encountered  
something similar in the past, but can’t recall the solution. Here’s  
my setup:

I have a form on a webpage that submits via AJAX using JQuery and  
JQuery-form. This is what it does:

1. User clicks checkboxes in the form to select any number of users to  
send message to.
2. User clicks submit, which triggers an AJAX post
3. respond\_to js opens a hidden div generated from a partial which is  
displayed in a fancybox lightbox
4. The partial shown in the lightbox contains a text area with a  
character count which will not update when I type in the field!
  - If I just render this partial on the page, the character count  
update works fine. I just can’t get it to work post-AJAX.

I’m happy to post code, but I’m wondering if there’s a general rule  
that I’m missing.

Any ideas?
