You are here: Forums Ask a Rails expert RJS partial rendering...
Posted in Forums : Ask a Rails expert
Authority 0
Posting Rating 23
Sign in to rate this post
|
I’m having a problem with the RJS Partial rendering. Scenerio: Ajax link generator <%= link_to_remote "ProductSets", :url => "/categories/1/product_sets", :method => :get %> and the generated html/js is <a onclick="new Ajax.Request('/categories/1/product_sets', {asynchronous:true, evalScripts:true,
method:'get', parameters:'authenticity_token=' +
encodeURIComponent('164e6c54bbb20a0b544e80ad8aa694bfa65cafeb')});
return false;" href="#">ProductSets</a>
Since the request hits /categories/1/product_sets via method :get, the index action is invoked. page.replace_html :contentTop, :partial => 'list_product_sets', :collection => @product_sets When I click the ProductSets link, the div with ID contentTop is replaced with the response from the server. But the response is all javascripts.
try {
Element.update("contentTop", "\u003Cdiv class=\"innerConte .. ....
All the html contents of the partial _list_product_sets.html.erb is returned with encoded javascript codes. Can Anyone plz explaing me Whats wrong with the above code?? Thanks |
Authority 50
Posting Rating 89
Sign in to rate this post
|
Its seems to do right job, but incorrectly.. |
Authority 0
Posting Rating 23
Sign in to rate this post
|
@Alexey, |
Authority 62
Posting Rating 98
Sign in to rate this post
|
Are you sure you havent used the :update otion for link_to_remote ? The server response is okay, but what is done with it by the browser indicates that the JS returned by the server is used by Element.update instead of evaluated… Anyway, if you’ve chosen to go Alexey’s way then perhaps this would be even better: In your controller: Now you can get rid of the index.html.erb or index.rhtml file which only contained 1 line of code anyway… |
Ask a Rails expert : nested application ApplicationController get called intead of children::ApplicationController
Ask a Rails expert : Best way to structure a database for a large/static dataset
Ask a Rails expert : Ruby Developer (ROR) - Scottish based (Remote working from within the UK)
Ask a Rails expert : Above Ground Pool Supplies
Ask a Rails expert : How to get url params in observer or model in Rails 3.1
Ask a Rails expert : What can persuade you to hire Junior Ruby devs with significant PHP experience?
Ask a Rails expert : What industry value does the Ruby or Rails Certification currently have?
Ask a Rails expert : Louis Vuitton Damier Azur Canvas specially sale ( www.salecheaplouisvuitton.com )
Ask a Rails expert : ·How to check errors/puts statements from ruby files which are under cronob
Ask a Rails expert : Louis Vuitton cheap Soft Sided Luggagespecial offer( www.salecheaplouisvuitton.com )