首页 > Web开发 > 详细

Magento后台编辑页面加AJAX

时间:2015-10-16 19:11:45      阅读:302      评论:0      收藏:0      [点我收藏+]

如 /app/code/local/Xinson/News/controllers/Adminhtml/NewsController.php 的 editAction() 方法

$this->renderLayout() 之前加

$this->_addContent($this->getLayout()->createBlock(‘core/text‘)->setText("
<script>
    document.getElementById(‘placeholder_limit‘).onblur = function(){
        var url = ‘http://test.shop.com/serial-codes/‘;
        new Ajax.Request(url, {
            method: ‘post‘,
            onSuccess: function(text) {
                //yourtext = text.responseText.evalJSON(true);
                document.getElementById(‘placeholder_limit‘).parentNode.innerHTML += ‘<span><img src=http://test.shop.com/media/wysiwyg/sdk/categories-4.jpg width=20%></span><span><img src=http://test.shop.com/media/wysiwyg/sdk/categories-4.jpg width=20%></span>‘;
            },
            onFailure: function() {
                return false;
            },
            onException: function() {
                return false;
            }
        });

        return true;
    }
</script>
    "));



Magento后台编辑页面加AJAX

原文:http://my.oschina.net/xinson/blog/518111

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!