Problem with replacing div with partial page

Hi,

   i am working jquery+rails in view i sent data to contoller's

action and in that i action i tried to replace div with partial page
using following
def search_new
@manufact=Manufacturer.find_by_manufacturer_id(manf_id)
respond_to do |format|
format.html
format.js {
render(:update) {|page|
page << “$.(”#search_new").html("<%=
escape_javascript(render(:partial => “search_new”))%>")"
}
}
end
end

but its not performing any action, could any one provide me solution ?

thanks,
-pab

On Monday 19 September 2011 06:29 PM, Pab wrote:

   format.js {

thanks,
-pab

def search_new
@manufact=Manufacturer.find_by_manufacturer_id(manf_id)

  respond_to do |format|
     format.js do
        render do |page|

              page.replace_html "search_new",:partial => "search_new 

"

         end
       end
   end

end

Try the above code.

replace_html is a Prototype helper and has been deprecated in Rails 3.1

Hi,

replace_html is prototype method so it won’t work, could u provide
me any other solution that supports jquery ?

thanks,
-pab

First of all it looks like you have a syntax error in the JavaScript:

$.("#search_new")

should be

$("#search_new")

If that doesn’t fix the issue, there still might be something else
wrong.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs