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

  • Home
  • SEARCH
  • 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 318595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:35:02+00:00 2026-05-12T08:35:02+00:00

I have a controller setup that uses a whole bunch of different AjaxContent helpers.

  • 0

I have a controller setup that uses a whole bunch of different AjaxContent helpers.
My init() for the controller looks something like this:

$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('index', 'html')
        ->addActionContext('compose', 'html')
        ->addActionContext('sent', 'html')
        ->addActionContext('recipients','html')
        ->addActionContext('inbox', 'html')
        ->addActionContext('sendsuccess','html')
        ->initContext();

At the end of the composeAction(), if a certain condition is met, the AJAX request should forward to sendsuccessAction().

Doing this with the standard _forward() method doesn’t seem to forward it as an AjaxContent request – the page wants to render using the standard view template.

Any ideas on how I can use _forward or some other redirect method but keep the request as an AJAX request so the proper action context fires?

  • 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-12T08:35:02+00:00Added an answer on May 12, 2026 at 8:35 am

    Basically what’s happening is that the initContext() method (which sets up the environment for an ajax response) only gets called for your first dispatched action, not the second.

    There’s a bunch of different ways around this.

    First, to verify this is the issue, try calling

    $this->_helper->ajaxContext->initContext();
    

    from your sendsuccessAction. This will force the AjaxContext action helper to properly set up the viewRenderer again.

    Alternatively, you could move the call to $ajaxContext->initContext() from the init() method to the preDispatch() method of your controller. This will cause it to run before each action is dispatched.

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

Sidebar

Related Questions

I have an ASP.NET MVC2 application that uses a parent controller to setup specific
In my controller I have model operations that can return empty results. I've setup
I have a Spring controller that returns XHTML, what's the easiest way to setup
I have a CI application that uses .htaccess for URL routing. My basic setup
I have a comment controller that uses a form partial to add comments. Now
I have an ASP.NET MVC 3 application that uses the Ninject.MVC3 extension to setup
So basically what I want to do is have my routes.php setup so that
I have an iPad app where I have a view controller that is the
I have a rails app that uses Sunspot and Solr for search functionality. I'm
I have a rather simple CakePHP app that uses the Auth component to restrict

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.