ajax - Rails 4 render collection in partial via escape_javascript -


I have the following code, which I want to submit via Javascript (via AJAX Pagination Pagination):

  & lt; Div id = "paginator-jobs-top" class = "text-center" & gt; & Lt;% = paginate @jobs, remote: true, theme: 'twitter-bootstrap-3', param_name: 'jobs', params: {tab: 'jobs'}, paging_spepe: 'endorsement-small endorsement-centric'% & Gt; & Lt; / Div & gt; & Lt; Div id = "jobs" & gt; & Lt;% = Partial assign: 'jobs / job_panel', collection: @jobs, like :: job% & gt; & Lt; / Div & gt; & Lt; Div id = "paginator-jobs-bottom" class = "text-center" & gt; & Lt;% = paginate @jobs, remote: true, theme: 'twitter-bootstrap-3', param_name: 'jobs', params: {tab: 'jobs'}, paging_spepe: 'endorsement-small endorsement-centric'% & Gt; & Lt; / Div & gt;  

And I was trying with this js.erb code but it is not working at all:

  $ ('# paginator-jobs (Tabs: "Jobs"}, Pagination_class: "Jobs", "http: // www.", "Jobs", "Twitter", "Twitter-BootStrap-3", Permanent_name: "Jobs", Params: {Tab: "Jobs"}, "Paging-less endorsement-centric"). To_s)%>;); $ ('# Jobs'). Html ('& lt;% = escape_javascript (partly assigned: "job / job_panel", archive: @jobs, like :: job)%>);  

I tried other variations but none of them worked. If someone knows how to present the code above in the js.erb method, I would love to hear it!

I have an error from above:

  Logic error - number of false arguments (0 for 1)  

when I Try it with a slightly different line in the js.erb snippet ('without job: j'):

name error - unchanged local variable or method # for job # job ; Category: 0x

**** I changed my revenge on the suggestion of Blackpool below. This code is ***

  & lt; Div id = "jobs" & gt; & Lt;% = Partial assign: "jobs / job_panel", archive: @jobs, like :: job% & gt; & Lt; / Div & gt;  

which works without AJAX (this is actually the correct way to partially present the collection in the rail, my fault first). However, when I adjust it to the js.erb file, I still get an error:

  $ ('# jobs'). Html ('& lt;% = escape_javascript (partial hand:' 'Employment / Job_panel ", collection: @jobs, like :: job)%> From the camera:  
  No mathier error - Undefined method `current_page 'for zero: NilClass: Camineri (0.16.1) Lib / Camineri / assistants / action_view_extension.rb: 18:` supported Try 'in'  

Try:

  $ ('# Jobs') .HTML (' & lt;% = raw @ jobs.collect {| j | escape_javascript (render: partial = & gt; "jobs / job_panel" ,: local => {: job = & Gt; j}}} .join ("")%> gt;);  

Simple, providing a collection

  $ ('# jobs') .HTML (' & lt;% = raw escape_javascript (render: partial = & gt; "job / job_panel",: archive = & Gt; @ Jobs, AJ = & gt;: Jobs)%>);  

Comments