Hi I'm having a problem in Firefox detecting if the request is xmlHttpRequest
in my php code, my code seems to work fine when using IE and Chrome. I'm
using Magento which is based on the Zend Framework and using the Zend
isXmlHttpRequest() function to test whether or not the request is an xhr one
or not. In Firefox this seems to return false even when I make an ajax call
using Prototype.
Here's the prototype code, perhaps I'm doing something wrong here:
var shop = {
cart: {
init: function(){
var product_forms = $$('.ajax-add-to-cart');
if (!product_forms[0]) return;
product_forms.invoke('observe', 'submit',
shop.cart.add);
},
add: function(e){
var ele = e.element();
ele.request({
onFailure: function() {},
onSuccess: function(t)
{$('header-cart').replace(t.responseText);}
});
Event.stop(e); // stop the form from submitting
},
remove: function(productId){
}
}
}
And here's the php code that tests if its an xhr request:
if($this->getRequest()->isXmlHttpRequest())
{
$this->loadLayout();
$this->getResponse()->setBody($this->_getSideCartHtml());
}
else
{
Varien_Profiler::start(__METHOD__ . 'cart_display');
$this->loadLayout();
$this->_initLayoutMessages('checkout/session');
$this->_initLayoutMessages('catalog/session');
$this->getLayout()->getBlock('head')->setTitle($this->__('Shopping
Cart Ajax 2'));
$this->renderLayout();
Varien_Profiler::stop(__METHOD__ . 'cart_display');
}
Thanks in advance for any help, this one has me really scratching my head.
--
View this message in context:
http://www.nabble.com/Firefox-Ajax-problem-tp25868337p25868337.html
Sent from the Zend Framework mailing list archive at Nabble.com.