[英]Jquery callback not firing
I've got a line of code that looks like this where the callback never gets executed: 我有一行看起来像这样的代码,其中回调从未执行:
GroupRepository.Add("#divSortingArea", oGroup, oSow.AddGroupToPage, (function() { alert(123); }));
Thks guys, no alert popup ! 伙计们,没有警报弹出窗口!
Cheers, Shotemba 干杯,Shotemba
here is the full code: 这是完整的代码:
function GroupRepository() { } 函数GroupRepository(){}
GroupRepository.Add = function(targetSelection, oGroup, addToPage) { GroupRepository.Add = function(targetSelection,oGroup,addToPage){
var tableToInsert = null;
var nGroupID = oGroup.nScopeOfWorkGroupID;
var sDescription = oGroup.sScopeOfWorkGroupDescription;
Eclipse3.GroupService.InsertGroup(Globals.N_JOB_ID, oGroup, InsertGroup_Success, InsertGroup_Error);
function InsertGroup_Success(response) {
nGroupID = parseInt(response.nIdentity);
var bConcurrencyId = response.bNewConcurrencyId;
//If this entry contains rows pull those rows out,
var rows = tableToInsert.find("tbody tr");
tableToInsert.remove();
oGroup.nScopeOfWorkGroupID = nGroupID;
oGroup.bConcurrencyId = bConcurrencyId;
var newGroupElement = addToPage(oGroup);
//add to the new group being created,
newGroupElement.find("tbody").append(rows);
//Globals.DisplayMessage("Insert Succeeded", "Your attempt to add a new record was successful.");
Globals.DisplayMessage("Insert Group Succeeded", "A new record was added.");
return this;
};
function InsertGroup_Error(error) {
Globals.HandleError("Item Group Failed", error);
};
} }
In your GroupRepository.Add there's only 3 parameters, targetSelection, oGroup and addToPage. 在GroupRepository.Add中,只有3个参数:targetSelection,oGroup和addToPage。 To extend the callback, declare a new function:
要扩展回调,请声明一个新函数:
function newCallBack(param) {
var result = oSow.AddGroupToPage(param);
alert(123);
return(result);
}
and then: 接着:
GroupRepository.Add("#divSortingArea", oGroup, newCallBack);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.