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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:07:06+00:00 2026-06-17T09:07:06+00:00

I will make an AJAX request in Magento block that call an action in

  • 0

I will make an AJAX request in Magento block that call an action in my own module controller. But the response of this request is 302, and redirect on the admin sign in page if i’m not sign in.
This request is on the front and don’t need admin sign in.

My javascript code :

var xmlhttp;
if(typeof XMLHttpRequest !== 'undefined') xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "http://mac-4.local:8888/magento_sample_1.4.2/index.php/disponibilityshippingicon/disponibility/setcustomeraddressinsession/", true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send('city=' + jsonAddress['city'] + '&cp=' + jsonAddress['cp'] + '&country=' + jsonAddress['country']);

My controler code :

class ColisWeb_DisponibilityShippingIcon_DisponibilityController extends Mage_Adminhtml_Controller_Action
{

public function setcustomeraddressinsessionAction() {
    $params = $this->getRequest()->getParams();
    Mage::log("ColisWeb - Addresse du visiteur non poussé en session : " . $params['city'] . $params['cp'] . $params['country'], Zend_log::INFO);
    if (isset($params['city'], $params['cp'], $params['country'])) {

        //new Mage_Customer_Model_Address();
        $address =  Mage::getModel('customer/address');
        $address->setCity($params['city']);
        $address->setPostCode($params['cp']);

        $session = Mage::getSingleton('core/session');
        $session->setData('addressColisweb', $address);
        $session->setData('cityAddressColisweb', $params['city']);
        $session->setData('postCodeAddressColisweb', $params['cp']);
        $session->setData('contryAddressColisweb', $params['country']);


    }
    else {


    }


    $this->getResponse()->setHeader('Content-type', 'application/json', true) ;
    $result = array( 'status' => '200');
    $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));   
}

}
?>

My version of Magento is 1.4.2

I hope somebody can help me.

Thanks for your help!

  • 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-06-17T09:07:07+00:00Added an answer on June 17, 2026 at 9:07 am

    Your controller extends Mage_Adminhtml_Controller_Action – it should be Mage_Core_Controller_Front_Action instead.

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

Sidebar

Related Questions

I'm working on a javascript function that when called will make a ajax request
I want to write a javascript function, that will make an ajax request to
I'm trying to make an AJAX form that will update a twitter status when
Hopefully this explanation will make sense, but what is the best way (if it
I know that this line of code will make the cell text-wrap: $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setWrapText(true); 'D1'
I make an Ajax request in which I set the response cacheability and last
I mean... Let's that we just make an AJAX request and inser the result
I have pretty much the same Ajax Request call but I need to expand
I'm trying to make a ajax request from my view, which will post &
I am using jQuery to make an AJAX request to a remote endpoint. That

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.