×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: bejoy balan
Added: Apr 5, 2018 11:15 AM
Views: 2982
  1.     <?php if ($helper->isAjaxUpdateEnabled()) : ?>
  2.         <div id="webextend-code"></div>
  3.         <script type="text/javascript">
  4.             document.observe("dom:loaded", function() {
  5.                 var unique_key_value = Math.random()*Math.random();
  6.                 new Ajax.Request('<?php echo $this->getAjaxUpdateUrl() ?>', {
  7.                     method:'post',
  8.                     evalJS: true,
  9.                     parameters: {unique_key: unique_key_value},
  10.                     onSuccess: function(transport) {
  11.                         var response = JSON.parse(transport.responseText);
  12.                         if(response.status == 1) {
  13.                             <?php if($helper->useJQuery()): ?>
  14.                             jQuery('#webextend-code').html(response.content);
  15.                             <?php else: ?>
  16.                             $('webextend-code').update(response.content);
  17.                             <?php endif; ?>
  18.                         }
  19.                     }
  20.                 });
  21.             });
  22.         </script>
  23.     <?php else: ?>
  24.         <?php echo $this->getChildHtml(); ?>
  25.     <?php endif; ?>
  26. <?php endif; ?>
  27.  
  28. ----------------------------
  29. <layout version="0.1.0">
  30.     <default>
  31.         <reference name="before_body_end">
  32.             <block type="webextend/webextend" name="webextend" template="emarsys/webextend.phtml">
  33.                 <block type="webextend/webextend" name="webextend.script" template="emarsys/javascripttracking.phtml">
  34.                     <action method="setCacheLifetime" ><lifetime>1</lifetime></action>
  35.                 </block>
  36.             </block>
  37.         </reference>
  38.     </default>
  39. </layout>
  40.  
  41.  
  42.