Open anilmuppalla opened 11 years ago
I have a index.html.erb (Question Controller)
def index @questions = Question.all respond_to do |format| format.html {render layout: false} format.json { render json: @questions } end end
In another View home.html.erb (StaticPageController)
<div id="test"> <a href="/questions"><img alt="attendence" class="img-rounded" height="60" src="/assets/marks.gif" width="60" /></a> </div>
and a target div in home.html.erb
<div data-pjax> </div>
I use pjax to grab the contents from index controller and display in the target div
In the file static_pages.js.coffee
JQuery -> ('#test a').pjax('[data-pjax]')
on clicking the link, it goes to a new page and does not replace the target DIV
I followed the Railcasts posted here to get till here.. what am i missing?
@4ni1 Pjax has change a bit since then. Put the following snippet outside doument ready (jQuery ->)
$(document).pjax('a', '#[data-pjax]')
Ohh saw the created date now :)
I have a index.html.erb (Question Controller)
In another View home.html.erb (StaticPageController)
and a target div in home.html.erb
I use pjax to grab the contents from index controller and display in the target div
In the file static_pages.js.coffee
on clicking the link, it goes to a new page and does not replace the target DIV
I followed the Railcasts posted here to get till here.. what am i missing?