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 6336723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:06:46+00:00 2026-05-24T19:06:46+00:00

For example I have an action in Controller. public function redirectnowAction() { $this->_redirect( ‘/module/controller/action’

  • 0

For example I have an action in Controller.

public function redirectnowAction() {
   $this->_redirect( '/module/controller/action' );
}

When I call above action in normal way then it redirect successfully to desired location But when I call above action by AJAX then it does not redirect to required URL and only show desired page content in firebug.

JS code for AJAX

jQuery('.AjaxLink').live( 'click', function(event) {
    event.preventDefault();
    // load the href attribute of the link that was clicked
    jQuery.getJSON(this.href, function(snippets) {
        for(var id in snippets) {
            // updated to deal with any type of HTML
            jQuery('#' + id).html( snippets[id] );
        }
    });
});

How to redirect to action after AJAX request ?

Thanks

  • 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-24T19:06:47+00:00Added an answer on May 24, 2026 at 7:06 pm

    You cannot do it directly, here’s what I’d do. In the action called via AJAX, include something like this:

    echo Zend_Json::encode(array('redirect' => '/module/controller/action'));
    

    This way, your AJAX call will receive a JSON object as a response. In jQuery’s $.ajax() call, you can specify a success event, e.g.:

    'dataType': 'json', // expects to receive a JSON-formatted response
    'success': function(data, textStatus, jqXHR) {
        window.location.replace('http://www.example.com' + data.redirect);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to have URLs that are even shorter than /{Controller}/{Action}/{Id}. For example, I'd
I have to pass some parameter from an action to another action,for example to
I have a rest controller example im trying to run that is giving me
Do I have to do anything special to my controller action method to accept/bind
I have an Ajax.Action link hooked up to a post method in my controller
I have the following controller that, among other methods it has this one: class
I have a controller action in ASP.NET MVC that handles uploaded files. However, it
How can I delay actions between keypress in jQuery. For example; I have something
If I for example have <p> some long text </p> on my HTML page,
Why does: const char example; (uint64*)example have a value of 140734799798420 and *(uint64*)example have

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.