Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7561105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:05:04+00:00 2026-05-30T13:05:04+00:00

I have this code: // controller function contact($token) { $this->layout = ‘ajax’; } //

  • 0

I have this code:

// controller  
function contact($token) {
  $this->layout = 'ajax';
}

// contact element
<some html, no php>

// contact view html + javascript
<script type=".....">
....
$.post(
    $(this).attr("href"),
    null,
    function(data){
              $(data).appendTo($(".contact_store_link").parent()).fadeIn();
            }
    );
</script>

<!-- the relevant html -->
<dd><a class="contact_store_link" href="/stores/contact">link title</a></dd>

The problem is that regardless of the $this->layout = 'ajax'; directive, the returned layout is the default layout that is set in the appController.beforeFilter() function.

The thing is, except of the layout, the rest of the code is working just fine. the correct controller + action + passed arguments. the element and view also works fine and the returned data contains the processed data, just in the wrong layout.

clearing the tmp folder didn’t help.
I also verified that the ajax layout is as it should be (and works in another controller.action+view set).

?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:05:05+00:00Added an answer on May 30, 2026 at 1:05 pm

    You could try:

    
    function contact($token) {
      $this->layout = 'ajax';
      $this->render("ajax_view_name", FALSE);
    }
    
    

    Hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in my controller (admin): function save(){ $model = $this->getModel('mymodel'); if
I have this in my controller: function foo() { // my code redirect(site_url('competitor/main'), 'refresh');
I have this code : jQuery('#btSave').click(function (event) { var jqxhr = $.post(Controller/Action, { lastName:
I have this code in a assets controller to get images: function images($path,$image_name) {
I have this code in my controller and want to test this code line
In our code we used to have something like this: *(controller->bigstruct) = ( struct
I have this code: chars = #some list try: indx = chars.index(chars) except ValueError:
I have this code that performs an ajax call and loads the results into
I have this code <?php session_start(); if (isset($_GET[cmd])) $cmd = $_GET[cmd]; else die(You should
I have this code in a js file: function buildRolePicker() { var pnl =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.