Jump to content

Newbie: reaching js file from controller

- - - - -

  • Please log in to reply
No replies to this topic

#1
pbdq

pbdq

    Newbie

  • Members
  • Pip
  • 1 posts
Hi!
I've been struggling with a ajax/jquery html fraction update for a couple of days now, can't seem to get my head around it.
I can't get my update.js.erb file to run, this is how my relevant files look like:

The view:
<div id="menuwrapper">

      <div class="tabArea">

         <%= link_to 'Link', {:action => 'update', :controller => 'welcome'},{:class=>"tab",:remote=>true} %>

      </div>

</div>

<div id="wrapper2">

    <!-- Where I want the html fragment-->

</div>




Welcome_controller:
def update

    respond_with do |format|

        format.js

    end

end


Route:
get "welcome/update"

update.js.erb:
$('#wrapper2').html("<%= escape_javascript render(:file => 'c.html.erb') %>");


Would appreciate any help I could get! This is the fourth forum I'm trying my luck in and hopefully the last! I'm about to lose it..

Thank you.

/Peter




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users