I,m trying to access Magento session data outside Magento using Json.Json is working fine in IE but when i tried to access Magento session data using json then it does't work. Code works in FF,Chrome,Opera .. but not in IE 7
Here is my server.php file
<?php
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
Mage::app();
if(isset($_GET['cart_item'])){
Mage::getSingleton('core/session', array('name'=>'frontend'));
$_cartQty=0;
$_cartItem='My Bag is empty';
foreach (Mage::helper('checkout/cart')->getCart()->getItems() as $item){
$_cartQty+=$item->getQty();
}
if ($_cartQty>0)
$_cartItem='My Bag ('. $_cartQty.')';
echo $_GET['callback'] . '('.json_encode(array('response'=>$_cartItem)).');';
}
?>
here is my client.html file
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
function change_cart_item(){
var cartItemUrl=jQuery('#cart_item_url').val();
jQuery.getJSON(cartItemUrl, function(json) {
var result=json.response;
alert(result);
//var cartItem = jQuery(result).find('#cart_item').html();
//jQuery("#show_cart span").html(result);
});
return false;
}
</script>
<input id="cart_item_url" name="cart_item_url" type="hidden" value="http://test.com/ie.php?callback=?&cart_item=cart_item" />
<input type="button" onclick="change_cart_item()" value="Change cart item" />
The above code always return "My Bag is empty" in IE.