Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Ajax.Updater to get a javascript file (prototypejs)
    text
    copied!<p>Here is my ajax request:</p> <pre><code>new Ajax.Updater({ success: 'footer' }, '/dyn/actions/checkSystemMessage', { insertion: 'after', evalScripts: true }); </code></pre> <p>Here is what's at /dyn/actions/checkSystemMessage:</p> <pre><code>&lt;script type="text/javascript"&gt;&lt;!-- document.observe('dom:loaded', function() { buildSystemMsg = function(SystemMsg) { //behind container behindContainer = new Element('div', {id: 'behind-system-message'}); behindContainer.setStyle({display: 'none'}); document.body.appendChild(behindContainer); //main container container = new Element('div', {id: 'system-message'}).update(SystemMsg); container.setStyle({display: 'none'}); document.body.appendChild(container); //hide button hideBtn = new Element('a', {'class': 'close-button', 'title': 'Close System Message'}).update('Close'); hideBtn.setStyle({ marginTop: '5px'}); container.insert({bottom: hideBtn}); offsetY = container.getHeight(); //show if ($('mod-system-alert')) { new Effect.Move($('mod-system-alert'), { queue: 'front', x: 0, y: offsetY, mode: 'relative', duration: 0 }); } new Effect.Move($('footer'), { queue: 'front', x: 0, y: offsetY, mode: 'relative', duration: 0 }); new Effect.Move($('page-container'), { queue: 'front', x: 0, y: offsetY, mode: 'relative', duration: 0 }); new Effect.Move($('nav'), { queue: 'front', x: 0, y: offsetY, mode: 'relative', duration: 0 }); new Effect.Move($('header-container'), { queue: 'front', x: 0, y: offsetY, mode: 'relative', duration: 0 }); Effect.BlindDown(behindContainer, { queue: 'front', duration: 0 }); Effect.BlindDown(container, { queue: 'end', duration: 0.5 }); hideBtn.observe('click', function() { if ($('mod-system-alert')) { new Effect.Move($('mod-system-alert'), { queue: 'front', x: 0, y: -offsetY, mode: 'relative', duration: 0 }); } new Effect.Move($('footer'), { queue: 'end', x: 0, y: -offsetY, mode: 'relative', duration: 0 }); new Effect.Move($('page-container'), { queue: 'end', x: 0, y: -offsetY, mode: 'relative', duration: 0 }); new Effect.Move($('nav'), { queue: 'end', x: 0, y: -offsetY, mode: 'relative', duration: 0 }); new Effect.Move($('header-container'), { queue: 'end', x: 0, y: -offsetY, mode: 'relative', duration: 0 }); Effect.BlindUp(behindContainer, { queue: 'front', duration: 0 }); Effect.BlindUp(container, { queue: 'front', duration: 0.5 }); set_cookie("HideSystemMsg", true); }); } hideMsg = get_cookie("HideSystemMsg"); systemMsg = '${SystemMsg}'; if (systemMsg.length &gt; 0 &amp;&amp; !hideMsg) buildSystemMsg(systemMsg); }); --&gt;&lt;/script&gt; </code></pre> <p>This is neither inserting the javascript after the element with ID footer nor is it executing the script. It does rely on other javascript libraries that are included on the page where the update is occurring. Could this be where my problem is?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload