I have set up a periodically call remote on a page. To get it to stop
calling I have made it reliant on a hidden element being populated
with some value, this is all working.
But I want to actually delete the script from the DOM based on a
decision from the server.
What would be the best way to go about doing this?
I have set up a periodically call remote on a page. To get it to stop
calling I have made it reliant on a hidden element being populated
with some value, this is all working.
But I want to actually delete the script from the DOM based on a
decision from the server.
What would be the best way to go about doing this?
One way to handle it would be to wrap the periodically_call_remote with a <div id="unique_id> and use RJS. Either page.replace or page.replace_html depending on whether you wanted to get rid of the div entirely or just some of what's inside.
I have set up a periodically call remote on a page. To get it to stop
calling I have made it reliant on a hidden element being populated
with some value, this is all working.
But I want to actually delete the script from the DOM based on a
decision from the server.
What would be the best way to go about doing this?
One way to handle it would be to wrap the periodically_call_remote with a
<div id="unique_id> and use RJS. Either page.replace or page.replace_html
depending on whether you wanted to get rid of the div entirely or just some
of what's inside.
That won't work because DIV only launches the JavaScript object. This persists in memory for ever and ever.
The fix is to use :condition to detect a JS variable, and then use another Ajax update to set this to false.
I have set up a periodically call remote on a page. To get it to stop
calling I have made it reliant on a hidden element being populated
with some value, this is all working.
But I want to actually delete the script from the DOM based on a
decision from the server.
What would be the best way to go about doing this?
I answered this a couple days ago. Use Google Groups and look for periodically_call_remote and my street name.