# Javascript script not loaded in partial (Ajax gurus... ?Â°

**URL:** <https://www.ruby-forum.com/t/javascript-script-not-loaded-in-partial-ajax-gurus-a/117204>\
**Category:** Rails\
**Created:** [October 14, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/javascript-script-not-loaded-in-partial-ajax-gurus-a/117204 "2007-10-14T19:30:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [October 14, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/javascript-script-not-loaded-in-partial-ajax-gurus-a/117204/1 "2007-10-14T19:30:27Z")

</div>

an Ajax request to my FranchiseController updates my page correctly

page.replace\_html ‘table\_list\_item’, :partial =\> ‘item\_franchise’  
page.show ‘show\_list\_item’

performed correctly

in my \_item\_franchise partial view, I have another nested partial to  
display a list of documents  
…

  
\<%= render :partial =\> ‘documents’ -%\>  

  
…

\_documents.rhtml view is displaying correctly the list of documents as a  
tree , using fairly javascript

...\<%= get\_tree\_data(@documents, 0){|n|... and so on... \</div

BUT at the end of this partial there is a \<  
script type=“text/javascript”\>  
… with some functions to be used when clicking somewhere in the tree,  
like  
function toggleMyTree(id) { … }  
…

my problem is I GET A JAVASCRIPT ERROR : toggleMyTree is not defined  
which happen because it seems that the script is not loaded with the  
partial …  
or mybe I am wrong … something else happen

any clue ?

thanks a lot for your help
