如何从 ExtJs 中的 ajax 响应更新 "href"
how to update the "href" from ajax response in ExtJs
我需要根据 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
}
首先,id 123 没有在 <a>
标签中定义。
<a hidefocus="on" id="123" class="x-tree-node-anchor" href="#" tabindex="1" target="contentFrame">Audit</a>
其次要触发点击,我们需要在所选元素上使用函数 click()
。
jQuery("#123").click();
我需要根据 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
}
首先,id 123 没有在 <a>
标签中定义。
<a hidefocus="on" id="123" class="x-tree-node-anchor" href="#" tabindex="1" target="contentFrame">Audit</a>
其次要触发点击,我们需要在所选元素上使用函数 click()
。
jQuery("#123").click();