Ajax request failing Rails -


i little stumped why ajax call failing, working , cannot think of changes have affected it. when make call error in firebugs console points in jquery.js file

// send request // may raise exception // handled in jquery.ajax (so no try/catch here) xhr.send( ( s.hascontent && s.data ) || null ); 

firstly mean?

my setup so

index.js.erb

<% if params[:type] == 'tynewydd' %>  $('#newsresults').html('<%= escape_javascript(render partial: 'tynewyddposts') %>'); <% end %> 

index.html.erb

 <div id="newsresults">    <div class="hero-unit">      <h2> welcome admin area</h2>        <p> xxxxxxxx.</p>          <p>xxxxxxxxx</p>    </div>   </div> 

link ajax request

<li><%= link_to 'tynewydd', posts_path(:type => 'tynewydd'), :remote => true %></li> 

can see going wrong here please or offer debugging suggestions?

any appreciated

edit

controller

def index @posts = post.all @tynewyddpost = post.tynewydd_posts @woodsidepost = post.woodside_posts @elmspost = post.elms_posts @sandpiperpost = post.sandpiper_posts @outreachpost = post.outreach_posts @companypost = post.company_posts @staffpost = post.staff_posts  respond_to |format|   format.html   format.js   end 

ok no longer getting error, had undefined method error nil class in called partial, in console can see response partial supposed render not display on page

thanks

ok in-case else runs similar issue changing $ jquery has solved problem, this

<% if params[:type] == 'tynewydd' %>  $('#newsresults').html('<%= escape_javascript(render partial: 'tynewyddposts') %>'); <% end %> 

was changed this

<% if params[:type] == 'tynewydd' %>   jquery('#newsresults').html('<%= escape_javascript(render partial: 'tynewyddposts') %>'); <% end %> 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -