A problem with fuel_set_var('layout', '')

edited September 2012 in Share
I have a view that I am calling with an ajax call:
<li><a href="#" class="icon" id="howtousecoffeegrounds"><span>How to Reuse Coffee Grounds</span></a></li> $('.icon').click(function(e) { e.preventDefault(); var view = $(this).attr('id'); $.ajax({ type: 'POST', url: view, success: function(data) { $('#page').hide(); $('#page').html(data); $('#page').slideDown('slow'); } }); });
Although I have this line at the top:
<?php fuel_set_var('layout', ''); ?>
the view still displays the layout (header, footer etc.)

Why is that?

Comments

  • edited 7:47PM
    Adding fuel_set_var should remove the layout. Are you sure it is pulling in that particular page? I noticed that you have "howtousecoffeegrounds" but having prefixed the url value in the ajax with any sort of base path so the link would be relative. Could that be the issue?
  • edited 7:47PM
    Ok, that solved the issue, found in another post:
    Adding the below code to the main layout file:
    $this->load->helper('ajax'); if(!is_ajax()) $this->load->view('_blocks/header')?>
  • edited 7:47PM
    I also had to leave this code in the howtousecoffeegrounds view:
    fuel_set_var('layout','');
Sign In or Register to comment.