Topic: Updating a div using JQuery with data from a Rails Model
Hi, I am new to Ajax and Rails and I am not too sure as to how I should go about updating a div using Jquery.
I have googled around and found that Ajax seems to be the answer but I am not too sure as to how I could go about doing it.
I am trying out loading a div using data from a Rails model.
I have added format.js to the controller actions.
And also the following codes to my model. The fields being the information I want to send over to my Jquery.
def as_json(options={})
{
:group_index =>self.group_index
:lesson_type =>self.lesson_type
:timeslot_id =>self.timeslot_id
}
end
Now, I am not too sure as to what I should put in my javascript to get the data from Rails.
I have been looking around but the examples provided are mostly based on forms where they used :remote=>true and I am not too sure if what I am trying to achieve is possible.
I would appreciate it if someone could point me to some articles I could refer to or help me out on how I could actually get the data from Rails.