1

I am updating DIV element on Onchange event of dropdown. And I am using partial to replace the content in the DIV. Here is my ajax call:

  var cach_this = this;
        $j.ajax({
            url: url,
            context: document.body,
            complete: function(text,status){
                cach_this.runtime_container[0].innerHTML = text.responseText;
            }
        });

url: is call to controllers method

And from controller it will render like this:

render :partial => "choose_by_all", :locals => {:uniq_id => params[:uniq_id]}, :layout => false

The partial content gets loaded perfectly, But inline javascript in partial dosen't execute.

1 Answer 1

2

I was stuck with the same problem in one of my Rails 2 app, after days of Googling, reading docs etc it turned out that Javascript is executed on page load. Loading a partial with some Javascript function in it will not fire unless to explicitly call the function.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.