Magento 中使用AJAX异步提交数据(Using Ajax with Magento)
如果你想用ajax提交magento的表单数据,可以尝试这种写法getUrl('yourmoduleCompanyName/index/moduleIndexControllerAction') ?>', {asynchronous:true, evalScripts:fal
·
如果你想用ajax提交magento的表单数据,可以尝试这种写法
<form name="sampleform" id="sampleform" οnsubmit="new Ajax.Updater({success:'sampleform’}, '<?php echo $this->getUrl('yourmoduleCompanyName/index/moduleIndexControllerAction') ?>', {asynchronous:true, evalScripts:false, onComplete:function(request, json){Element.hide('sampleform');Element.show('sampleform');}, onLoading:function(request, json){}, parameters:Form.serialize(this)}); return false;" method="post">
这样讲表单的数据提交到你所指定的控制器中
<?php echo $this->getUrl('yourmoduleCompanyName/index/moduleIndexControllerAction') ?>
magento内置的Ajax类会帮你异步处理所需的请求,详细的参数可参加Ajax类!
更多推荐
所有评论(0)