To Get the Value From Ajax
--------------------------------------------------------------
<div class="divButtons">
<a data-toggle="modal" href="#windowTitleDialog" class="product_id"><span><img src="<?php echo $this->getSkinUrl('images/cart_button2.png'); ?>" alt="" title="" /></span></a>
<?php
$_compareUrl = Mage::helper('catalog/product_compare')->getAddUrl($_item);
$_wishlistUrl =Mage::helper("wishlist")->getAddUrl($_item);
?>
<input type="hidden" id="h_v" class="hv" name="rahul" value="<?php echo $_item->getId(); ?>">
<input type="hidden" id="h_v" class="hvv" name="rahul" value="<?php echo $this->getAddToCartUrl($_item) ?>">
<input type="hidden" id="h_v" class="hv_b" name="rahul" value="<?php echo $_compareUrl; ?>">
<input type="hidden" id="h_v" class="hv_c" name="rahul" value="<?php echo $_wishlistUrl; ?>">
</div>
<script>
jQuery(document).ready(function()
{
jQuery(".product_id").click(function()
{
jQuery(".divDemoBody").hide();
var key=jQuery(this).parent().find(".hv").val();
var key_b=jQuery(this).parent().find(".hvv").val();
var key_c=jQuery(this).parent().find(".hv_b").val();
var key_d=jQuery(this).parent().find(".hv_c").val();
var caldate=key;
var caldate_b=key_b;
var caldate_c=key_c;
var caldate_d=key_d;
jQuery.ajax({
url: 'http://xyz/magento/ajx.phtml',
type:"POST",
data:({name:caldate,name_b:caldate_b,name_c:caldate_c,name_d:caldate_d}),
success: function(cbG02_msg) {
console.log(cbG02_msg);
jQuery(".pop-up").html(cbG02_msg);
jQuery(".divDemoBody").show();
},error: function(e , f){
console.log('error');
alert("error");
}
});
});
});
</script>
<div class="divDemoBody">
<div id="windowTitleDialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="windowTitleLabel" aria-hidden="true">
<div style="float:right;margin-right: -33px;margin-top: -28px;">
<button type="button" class="close111"><span><span><span><img src="<?php echo $this->getSkinUrl('images/ajaxcart/close-popup.png');?>"/></span></span></span></button>
</div>
<div class="modal-header">
<div class="pop-up"> </div>
</div>
</div>
-----------------------------------------------------------------------------------------
on other path (http://xyz/magento/ajx.phtml)
to get the post value
<?php
$val=$_POST['name'];
$val1=$_POST['name_b'];
$comp=$_POST['name_c'];
$wish=$_POST['name_d'];
?>
<div class="divButtons">
<a data-toggle="modal" href="#windowTitleDialog" class="product_id"><span><img src="<?php echo $this->getSkinUrl('images/cart_button2.png'); ?>" alt="" title="" /></span></a>
<?php
$_compareUrl = Mage::helper('catalog/product_compare')->getAddUrl($_item);
$_wishlistUrl =Mage::helper("wishlist")->getAddUrl($_item);
?>
<input type="hidden" id="h_v" class="hv" name="rahul" value="<?php echo $_item->getId(); ?>">
<input type="hidden" id="h_v" class="hvv" name="rahul" value="<?php echo $this->getAddToCartUrl($_item) ?>">
<input type="hidden" id="h_v" class="hv_b" name="rahul" value="<?php echo $_compareUrl; ?>">
<input type="hidden" id="h_v" class="hv_c" name="rahul" value="<?php echo $_wishlistUrl; ?>">
</div>
<script>
jQuery(document).ready(function()
{
jQuery(".product_id").click(function()
{
jQuery(".divDemoBody").hide();
var key=jQuery(this).parent().find(".hv").val();
var key_b=jQuery(this).parent().find(".hvv").val();
var key_c=jQuery(this).parent().find(".hv_b").val();
var key_d=jQuery(this).parent().find(".hv_c").val();
var caldate=key;
var caldate_b=key_b;
var caldate_c=key_c;
var caldate_d=key_d;
jQuery.ajax({
url: 'http://xyz/magento/ajx.phtml',
type:"POST",
data:({name:caldate,name_b:caldate_b,name_c:caldate_c,name_d:caldate_d}),
success: function(cbG02_msg) {
console.log(cbG02_msg);
jQuery(".pop-up").html(cbG02_msg);
jQuery(".divDemoBody").show();
},error: function(e , f){
console.log('error');
alert("error");
}
});
});
});
</script>
<div class="divDemoBody">
<div id="windowTitleDialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="windowTitleLabel" aria-hidden="true">
<div style="float:right;margin-right: -33px;margin-top: -28px;">
<button type="button" class="close111"><span><span><span><img src="<?php echo $this->getSkinUrl('images/ajaxcart/close-popup.png');?>"/></span></span></span></button>
</div>
<div class="modal-header">
<div class="pop-up"> </div>
</div>
</div>
-----------------------------------------------------------------------------------------
on other path (http://xyz/magento/ajx.phtml)
to get the post value
<?php
$val=$_POST['name'];
$val1=$_POST['name_b'];
$comp=$_POST['name_c'];
$wish=$_POST['name_d'];
?>
Comments
Post a Comment