【问题标题】:how to update the "href" from ajax response in ExtJs如何从 ExtJs 中的 ajax 响应更新“href”
【发布时间】:2016-02-25 07:41:33
【问题描述】:

我需要根据 Ajax 响应更新 href 元素,并且需要从附加的 href 触发点击事件

我正在按照以下方式进行操作。但无法从更新的href 触发点击事件。

HTML

<a hidefocus="on" class="x-tree-node-anchor" href="#" tabindex="1" target="contentFrame">Audit</a>

ExtJs

listeners: {
      click: { 
          fn: function(node,event){
                    Ext.Ajax.request({           
                      url: '/ms/module/external-a/api/'+treeId+'/fetch-child/'+UUID,
                      method: 'GET',
                      success:  function (response) { 
                        var addInfoRes = Ext.util.JSON.decode(response.responseText);                   
                        var additionalInfohref = addInfoRes.href                // "/member/erp/config?node=12";  
                        jQuery("#123").attr('href',additionalInfohref);
                      }
                    });
            }         
        },stopEvent: true

}

【问题讨论】:

标签: extjs extjs3


【解决方案1】:

首先,&lt;a&gt; 标签中没有定义 id 123

<a hidefocus="on" id="123" class="x-tree-node-anchor" href="#" tabindex="1" target="contentFrame">Audit</a>

其次要触发点击,我们需要在被选元素上使用click()函数。

jQuery("#123").click();

【讨论】:

    猜你喜欢
    • 2013-05-23
    • 2012-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多