我试图从列表中调用带有参数的方法/函数,但它既不传递也不调用方法。这是我的代码。这是我的代码
列表
var searchfrieandtab= Ext.create('Ext.List', {
width: 320,
height: 290,
id : 'searchfriendslist1',
itemTpl: ['<div style="margin:0px;background:#fff;" >'+
'<table style="margin:0px;padding:0px;height:40px;" width="100%" >'+
'<tr><td style="padding:2px 5px;width:90%;"><span><img src="data:image/jpeg;base64,{userImage}"/>'+
'</span><span>{userFirstName}</span></td>'+
'<td style="padding:2px 10px;width:10%;">'+
'<img src="resources/img/addplus.png" onclick="invitefriends{\'{userId}\')"/>'+//HERE AM CALLING THE METHOD
'</td></tr></table></div>'].join(),
listeners : {
itemtap: function (list, index, item, record, senchaEvent) {
if (senchaEvent.event.target.nodeName == 'IMG') {
var data = record.getData();
var itemId = data.itemId;
var itemPurchased = data.itemPurchased;
}
}
}
});
方法
function invitefriends(friendid) {
alert("check",friendid);
Ext.Ajax.request({
//url: App.gvars.apiurl + 'InviteFriends/userID='+App.gvars.userid+'/friendID='+friendid, // url : this.getUrl(),
url:'http://192.168.1.155:8181/WishList/InviteFriends/userID=1/friendID='+friendid,
method: "GET",
useDefaultXhrHeader: false,
withCredentials: true,
success: function (response) {
var respObj = Ext.JSON.decode(response.responseText);
if(respObj[0].response=="Success"){
alert(Response)
Ext.Msg.alert("Invite Friends",respObj[0].MailResponse);
}else{
Ext.Msg.alert("Error",respObj[0].errorMsg);
}
},
failure: function (response) {
Ext.Msg.alert("Error",response.responseText);
}
});
}
我的代码有什么问题?请帮我解决