Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 26th, 2012  |  syntax: None  |  size: 0.66 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. render a partial after a successful ajax call?
  2. $.ajax({
  3.  url: "/update_fb_user?fb_uid=" + FB.getSession().uid,
  4.  dataType: 'json',
  5.  success: function(data){
  6.     if(data.user != "none"){
  7.         // here is where i need to render this partial
  8.     }else{
  9.         window.location.href = '/signup';
  10.     }
  11.  }
  12.        
  13. <div id="fb_iframe">
  14. <% unless current_user.not_using_facebook? %>
  15.     <%= render :partial => 'fb_iframe' %>
  16. <% end %>
  17. </div>
  18.        
  19. $.ajax({
  20.   url: "/update_fb_user?fb_uid=" + FB.getSession().uid,
  21.   dataType: 'json',
  22.   success: function(data){
  23.     if(data.user != "none"){
  24.       window.location.reload();
  25.     }else{
  26.       window.location.href = '/signup';
  27.     }
  28.   }
  29. });