Topic: How to enable closed jquery link

Have used ajax and jquery link to enable new and close functionality
problem scenario:
* While using ajax link to open the new content and closing the same using Jquery link its working fine wherein the same does not happen again while we try to open the new content immediately after closing the "New content"
* The above said works fine only while we refresh the page
How to resolve it ?

My code
<%= link_to_remote ('New', :url => new_expense_expense_session_path,:update=>"expense_session_new_edit_content") %>
<div id="expense_session_new_edit_content"></div>

<a href='#' id='close_session'>close</a>
<script type="text/javascript">
$(document).ready(function() {

Last edited by willm (2010-11-17 07:23:32)

Re: How to enable closed jquery link

You're replacing the original contents of 'expense_session_new_edit_content' div with the AJAX call. 

My guess is you're overwriting something there that makes it work first time,  but once you replace it via the AJAX call , you've broken it.

I think it's best to put your original content in one div,  and update a second div via the AJAX call,  and just toggle them off and on, that way your original content is always there.


<div id="orig">BEGIN</div>
<div id="dynamic" style="display:none"></div>

<%= link_to_remote('New', 
         :success=>"$('#orig').hide();$('#dynamic').show();" %>

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.