Simple AJAX example?

You can have your hello action like this: def hello #### your code goes here ##### respond_to do |format| format. Js { render :layout=>false } end end And one file hello.js. Erb $("#time_div").

Html("some text"); And your link will be: "questions", :action => "hello" }, :remote => true %>.

1. Where do I need to put hello.js. Erb?

View\questions\hello.js. Erb? 2.Do I need to install jQuery?

– demas Apr 5 at 10:30 Yes... you need jquery. And you need to keep hello.js. Erb in /views/questions folder – Ashish Apr 5 at 10:34 I cannot make it work.

I will be thankfull if you look at my code (github. Com/demas/test_ruby_ajax) and give me information about my mistake. – demas Apr 5 at 10:54 Ok... I will check it – Ashish Apr 5 at 10:59 I think you need rails.

Js for jquery. You still have rails. Js for prototype.

Just update it and include it in your layout file. – Ashish Apr 5 at 12:02.

Problem here is you are not returning anything from the controller action, Since you are using AJAX you need to return the result as either . Js or jason have a look at this example, with rails3 and Jquery https://github. Com/nu7hatch/rails3-ujs-example cheers sameera.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions