Topic: Javascript

Hi all. I am newbie to Rails

I want to update a div in the same page with a partial.
I have tried the following but not working.

in the create.js.rjs

page.replace_html 'div_1', :partial=>'student'

in the controller

def create
respond_to do |format|
      format.js
    end
end

can u help me please

Re: Javascript

Check if you're using prototype.js library, it's often ommited. Check also Firebug's output.

Re: Javascript

prototype.js exists in the javascripts directory

Re: Javascript

you have to make it available in your layout:

javascript_include_tag :all #or :defaults

Re: Javascript

I have included that also

Re: Javascript

Or do I have to install jquery or jrails plugin to make thus work?

Last edited by gyohannes (2011-06-08 04:37:58)

Re: Javascript

you have to download the latest version of jquery from http://code.jquery.com/jquery-1.6.1.min.js and put the js file in
'YOUR_APP/public/javascripts' folder and to include the jquery with 'javascript_include_tag' helper.
You can also see more details on rails casts: http://railscasts.com/episodes/227-upgr … s-3-part-3

Last edited by Javix (2011-06-08 05:46:07)

Re: Javascript

davidlaradavid wrote:

These error messages can be annoying and harmful to the registry on your computer. You can make your computer slows down, stops, crashes and other things that are frustrating for the user's computer.

then you just shouldn't forget to clen the register from time to time