why ajax call from magento backend(from .phtml) redirects to magento dashboard despite of sending form key properly with form? please help.
in ajax call :
var dataRecord = j('#newForm').serialize();
var url = "<?php echo $this->getUrl('*/*/addNewColumn') ?>";
j.ajax({
type: "POST",
url: url,
data: {data1: dataRecord}
})
.done(function( msg ) {
alert(msg);
});
It worked when i sent the form_key in 'data' of ajax call.
var dataRecord = jQuery('#newForm').serialize();
var url = "<?php echo $this->getUrl('*/*/addNewColumn') ?>";
<?php $k = Mage::getSingleton('core/session')->getFormKey(); ?>
jQuery.ajax({
type: "POST",
url: url,
data: {data1: dataRecord,form_key:'<?php echo $k ?>'}
})
.done(function( msg ) {
alert(msg);
});